1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
/* testnsp.cpp --- semantic-ia-utest completion engine unit tests
Copyright (C) 2008-2025 Free Software Foundation, Inc.
Author: Eric M. Ludlam <zappo@gnu.org>
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
*/
namespace nsp {
class rootclass {
public:
int fromroot() {};
};
}
namespace nsp {
class childclass : public rootclass {
public:
int fromchild() {};
};
}
void myfcn_not_in_ns (void) {
nsp::childclass test;
test.// -1-
; // #1# ( "fromchild" "fromroot" )
}
// Test a class declared in a class, where the contents
// are in a qualified name.
//
// Thanks Michael Reiher for the concise example.
class AAA
{
public:
AAA();
void aaa();
private:
class Private;
Private * const d;
};
class AAA::Private
{
Private() : bbb(0) {
}
BBB* bbb;
};
void AAA::aaa()
{
d->// -2-
; // #2# ( "bbb" )
}
// #include files inside a namespace
// David Engster <deng@randomsample.de>
// See revisions 8034-8037 which implement this.
namespace another {
#include "testdoublens.hpp"
}
void foo(void) {
another::// -3-
; // #3# ( "Name1" "a" "stage3_Foo" )
another::Name1::Name2::Foo a;
a.// -4-
; // #4# ( "Mumble" "get" )
}
// What happens if a type your looking for is scoped within a type,
// but you are one level into the completion so the originating scope
// excludes the type of the variable you are completing through?
// Thanks Martin Stein for this nice example.
namespace ms_structs
{
struct ms_aaa
{
int xx;
};
struct ms_bbb
{
struct ms_aaa yy;
};
};
int fun()
{
using namespace ms_structs;
struct ms_bbb mszz;
int uu = mszz.// -5-
; // #5# ( "yy" )
int kk = mszz.yy.// - 6- @TODO - bring in patch from SF
; // #6# ( "xx" )
}
|