diff options
| author | Chong Yidong | 2009-09-20 04:00:13 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-09-20 04:00:13 +0000 |
| commit | 17af2991b5bd71ed2d3d69fd4467e1fc8a31d8d1 (patch) | |
| tree | 8ff33ff92ead70e1a3aeead0d1334b4aedac027b /test/cedet/tests/scopetest.cpp | |
| parent | 00999a2ef0648870573dcb3a3866c6401db8bc28 (diff) | |
| download | emacs-17af2991b5bd71ed2d3d69fd4467e1fc8a31d8d1.tar.gz emacs-17af2991b5bd71ed2d3d69fd4467e1fc8a31d8d1.zip | |
Add Semantic unit tests.
Diffstat (limited to 'test/cedet/tests/scopetest.cpp')
| -rw-r--r-- | test/cedet/tests/scopetest.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/cedet/tests/scopetest.cpp b/test/cedet/tests/scopetest.cpp new file mode 100644 index 00000000000..e84dd0dde06 --- /dev/null +++ b/test/cedet/tests/scopetest.cpp | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | /* Test scoping rules for c++ in the analyzer. */ | ||
| 2 | |||
| 3 | namespace { | ||
| 4 | |||
| 5 | class aclass2; // Forward reference. | ||
| 6 | |||
| 7 | class aclass1 { | ||
| 8 | private: | ||
| 9 | int attrp1; | ||
| 10 | int amethodp1(int argp1); | ||
| 11 | aclass2 areference; | ||
| 12 | protected: | ||
| 13 | int attrpr1; | ||
| 14 | public: | ||
| 15 | int attr1; | ||
| 16 | int amethod1(int arg1); | ||
| 17 | }; | ||
| 18 | } | ||
| 19 | |||
| 20 | namespace { | ||
| 21 | class aclass2 : public aclass1 | ||
| 22 | { | ||
| 23 | private: | ||
| 24 | int attrp2; | ||
| 25 | int amethodp2(int argp1); | ||
| 26 | public: | ||
| 27 | aclass2(int aninitvalue); | ||
| 28 | ~aclass2(); | ||
| 29 | int attr2; | ||
| 30 | int amethod2(int arg2); | ||
| 31 | }; | ||
| 32 | } | ||
| 33 | |||
| 34 | aclass2::aclass2(init aninitvalue) | ||
| 35 | { | ||
| 36 | /* This is a comment that talks about aclass1 */ | ||
| 37 | aclass1; | ||
| 38 | } | ||
| 39 | |||
| 40 | int aclass2::amethod2(int arg2) | ||
| 41 | { | ||
| 42 | int alocalvar; | ||
| 43 | float q; | ||
| 44 | |||
| 45 | ac; | ||
| 46 | } | ||
| 47 | |||