[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests 23862f3 023/316: Test friends
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests 23862f3 023/316: Test friends |
Date: |
Sat, 28 Jan 2017 09:09:43 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit 23862f3d52080a15823a448ff2d9c98a9c6920c8
Author: Eric Ludlam <address@hidden>
Commit: Edward John Steere <address@hidden>
Test friends
* test/manual/cedet/cedet/semantic/tests/testfriends.cpp:
(Af): Add a friend of C w/out the CLASS token. (C): New. (scA, scB,
scC, scD): New test classes. (main): New (scA::PublicMethod,
scB::b_pub_method, scC::c_pub_method) (scD::d_pub_method): New.
---
.../cedet/cedet/semantic/tests/testfriends.cpp | 94 +++++++++++++++++++-
1 file changed, 93 insertions(+), 1 deletion(-)
diff --git a/test/manual/cedet/cedet/semantic/tests/testfriends.cpp
b/test/manual/cedet/cedet/semantic/tests/testfriends.cpp
index f84ed5a..ff6e440 100644
--- a/test/manual/cedet/cedet/semantic/tests/testfriends.cpp
+++ b/test/manual/cedet/cedet/semantic/tests/testfriends.cpp
@@ -14,7 +14,9 @@ public:
private:
int privateVar;
- friend class B;
+ friend class B; // Full class friend format.
+
+ friend C; // Abbreviated friend format.
};
@@ -26,6 +28,13 @@ public:
};
+class C
+{
+public:
+ int testC();
+ int testAC();
+
+};
int B::testB() {
Af classA;
@@ -35,3 +44,86 @@ int B::testB() {
int B::testAB() { // %1% ( ( "testfriends.cpp" ) ( "B" "B::testAB" ) )
}
+
+
+// Test friends when subclassing.
+class scA : public scB, public scC, public scD
+{
+public:
+ friend class scB;
+ friend scC;
+
+private:
+
+ int data;
+
+public:
+
+ int PublicMethod();
+
+};
+
+class scB
+{
+public:
+ int b_pub_method();
+protected:
+ int b_prot_method();
+private:
+ int b_priv_method();
+};
+
+
+class scC
+{
+public:
+ int c_pub_method();
+protected:
+ int c_prot_method();
+private:
+ int c_priv_method();
+};
+
+class scD // Not a friend
+{
+public:
+ int d_pub_method();
+protected:
+ int d_prot_method();
+private:
+ int d_priv_method();
+};
+
+
+int main()
+{
+ scA aclass;
+
+ aclass. //-2-
+ ; //#2# ( "PublicMethod" "b_pub_method" "c_pub_method" "d_pub_method")
+}
+
+
+int scA::PublicMethod() {
+ this. // -3-
+ ; // #3# ( "PublicMethod" "b_prot_method" "b_pub_method" "c_prot_method"
"c_pub_method" "d_prot_method" "d_pub_method" "data")
+}
+
+int scB::b_pub_method() {
+ scA myfriend;
+ myfriend. // -4-
+ ; // #4# ( "PublicMethod" "b_priv_method" "b_prot_method" "b_pub_method"
"c_pub_method" "d_pub_method" "data")
+}
+
+int scC::c_pub_method() {
+ scA myfriend;
+ myfriend. // -5-
+ ; // #5# ( "PublicMethod" "b_pub_method" "c_priv_method" "c_prot_method"
"c_pub_method" "d_pub_method" "data")
+}
+
+int scD::d_pub_method() {
+ scA myfriend;
+ // The NOT FRIEND can't see 'data' which is private to scA
+ myfriend. // -6-
+ ; // #6# ( "PublicMethod" "b_pub_method" "c_pub_method" "d_priv_method"
"d_prot_method" "d_pub_method")
+}
- [Emacs-diffs] scratch/merge-cedet-tests fb048d1 006/316: (semantic-c): Hack for Emacs 21 to get things running., (continued)
- [Emacs-diffs] scratch/merge-cedet-tests fb048d1 006/316: (semantic-c): Hack for Emacs 21 to get things running., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests c43f15e 015/316: Test project configuration file., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 026efb3 008/316: First changes to make them work., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 439ca10 007/316: Remove obsolete cvs-auto-updated 'X-RCS' line., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 1a9f3c4 009/316: Disable `ede-project-directories' checking during tests., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 39b4ea6 019/316: Test Makefile.am for subdir in project-am detector., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 812f259 012/316: Add header comments and provide., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests d9b806d 016/316: New template file testing the PROJECT variable setting., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests a2c77d6 022/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests d15788e 025/316: (Lisp_LISP): Add cit-cpp, cit-el, cit-texi, cit-load, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 23862f3 023/316: Test friends,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests 066e017 024/316: New Makefile., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ecfcde6 028/316: (all, dist): Add scripts (scripts): New, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests a4cba68 020/316: New test for project variables., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 8899bf4 017/316: Add header comments and provide., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests b13b432 031/316: (LOADPATH): Add contrib. (Misc): New (dist): Add Misc, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests cdcc2c4 037/316: (Lisp_LISP): Add cit-dist.el, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 42e1106 034/316: (Lisp_LISP): Add cit-uml.el (Misc_MISC): Add cit-uml.cgr, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 1d79c16 042/316: Remove obsolete cvs-auto-updated 'X-RCS' line., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 467bfc2 036/316: (ELISPPRELOAD): New (Lisp): Use preloads., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ada5514 040/316: Fix paths to current code location., Edward John Steere, 2017/01/28