testdoublens.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. // testdoublens.cpp --- semantic-ia-utest completion engine unit tests
  2. // Copyright (C) 2008-2012 Free Software Foundation, Inc.
  3. // Author: Eric M. Ludlam <eric@siege-engine.com>
  4. // This file is part of GNU Emacs.
  5. // GNU Emacs is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. // GNU Emacs is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // You should have received a copy of the GNU General Public License
  14. // along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. #include "testdoublens.hpp"
  16. namespace Name1 {
  17. namespace Name2 {
  18. Foo::Foo()
  19. {
  20. p// -1-
  21. // #1# ( "pMumble" "publishStuff" )
  22. ;
  23. }
  24. int Foo::get() // ^1^
  25. {
  26. p// -2-
  27. // #2# ( "pMumble" "publishStuff" )
  28. ;
  29. return 0;
  30. }
  31. void Foo::publishStuff(int /* a */, int /* b */) // ^2^
  32. {
  33. }
  34. void Foo::sendStuff(int /* a */, int /* b */) // ^3^
  35. {
  36. }
  37. } // namespace Name2
  38. } // namespace Name1
  39. // Test multiple levels of metatype expansion
  40. int test_fcn () {
  41. stage3_Foo MyFoo;
  42. MyFoo.// -3-
  43. // #3# ( "Mumble" "get" )
  44. ;
  45. Name1::Name2::F//-4-
  46. // #4# ( "Foo" )
  47. ;
  48. // @TODO - get this working...
  49. Name1::stage2_Foo::M//-5-
  50. /// #5# ( "Mumble" )
  51. ;
  52. }
  53. stage3_Foo foo_fcn() {
  54. // Can we go "up" to foo with senator-go-to-up-reference?
  55. }
  56. // Second test from Ravikiran Rajagopal
  57. namespace A {
  58. class foo {
  59. public:
  60. void aa();
  61. void bb();
  62. };
  63. }
  64. namespace A {
  65. class bar {
  66. public:
  67. void xx();
  68. public:
  69. foo myFoo;
  70. };
  71. void bar::xx()
  72. {
  73. myFoo.// -6- <--- cursor is here after the dot
  74. // #6# ( "aa" "bb" )
  75. ;
  76. }
  77. }
  78. // Double namespace example from Hannu Koivisto
  79. //
  80. // This is tricky because the parent class "Foo" is found within the
  81. // scope of B, so the scope calculation needs to put that together
  82. // before searching for parents in scope.
  83. namespace a {
  84. namespace b {
  85. class Bar : public Foo
  86. {
  87. int baz();
  88. };
  89. int Bar::baz()
  90. {
  91. return dum// -7-
  92. // #7# ( "dumdum" )
  93. ;
  94. }
  95. } // namespace b
  96. } // namespace a
  97. // Three namespace example from Hannu Koivisto
  98. //
  99. // This one is special in that the name e::Foo, where "e" is in
  100. // the scope, and not referenced from the global namespace. This
  101. // wasn't previously handled, so the fullscope needed to be added
  102. // to the list of things searched when in split-name decent search mode
  103. // for scopes.
  104. namespace d {
  105. namespace e {
  106. class Foo
  107. {
  108. public:
  109. int write();
  110. };
  111. } // namespace d
  112. } // namespace e
  113. namespace d {
  114. namespace f {
  115. class Bar
  116. {
  117. public:
  118. int baz();
  119. private:
  120. e::Foo &foo;
  121. };
  122. int Bar::baz()
  123. {
  124. return foo.w// -8-
  125. // #8# ( "write" )
  126. ;
  127. }
  128. } // namespace f
  129. } // namespace d