diff options
author | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
commit | 144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch) | |
tree | b12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/base/test101 | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/base/test101')
-rw-r--r-- | tests/base/test101/Bar.java | 11 | ||||
-rw-r--r-- | tests/base/test101/Driver.java | 33 | ||||
-rw-r--r-- | tests/base/test101/Foo.java | 11 | ||||
-rw-r--r-- | tests/base/test101/Pos.java | 19 | ||||
-rw-r--r-- | tests/base/test101/README | 4 |
5 files changed, 78 insertions, 0 deletions
diff --git a/tests/base/test101/Bar.java b/tests/base/test101/Bar.java new file mode 100644 index 000000000..99b516a40 --- /dev/null +++ b/tests/base/test101/Bar.java @@ -0,0 +1,11 @@ + +aspect Bar { + static int count = 0; + + before (): target(Pos) && + ( call(* getX(..)) || + call(* getY(..)) || + call(* move(..)) ) { + count++; + } +} diff --git a/tests/base/test101/Driver.java b/tests/base/test101/Driver.java new file mode 100644 index 000000000..9964538f3 --- /dev/null +++ b/tests/base/test101/Driver.java @@ -0,0 +1,33 @@ +import org.aspectj.testing.Tester; + +public class Driver { + public static void main(String[] args) { test(); } + + public static void test() { + + Pos p1 = new Pos(); + Pos p2 = new Pos(); + Pos p3 = new Pos(); + + Foo f1 = Foo.aspectOf(p1); + Foo f2 = Foo.aspectOf(p2); + Foo f3 = Foo.aspectOf(p3); + + p1.move(1, 2); + Tester.checkEqual(p1.getX(), 1, "p1.x"); + Tester.checkEqual(p1.getY(), 2, "p1.y"); + + p2.move(1, 2); + Tester.checkEqual(p2.getX(), 1, "p2.x"); + Tester.checkEqual(p2.getY(), 2, "p2.y"); + + p3.move(1, 2); + Tester.checkEqual(p3.getX(), 1, "p3.x"); + Tester.checkEqual(p3.getY(), 2, "p3.y"); + + Tester.checkEqual(f1.count, 3, "f1.count"); + Tester.checkEqual(f2.count, 3, "f2.count"); + Tester.checkEqual(f3.count, 3, "f3.count"); + Tester.checkEqual(Bar.count, 9, "Bar.count"); + } +} diff --git a/tests/base/test101/Foo.java b/tests/base/test101/Foo.java new file mode 100644 index 000000000..79097078a --- /dev/null +++ b/tests/base/test101/Foo.java @@ -0,0 +1,11 @@ + +aspect Foo pertarget(target(Pos)) { + int count = 0; + + before (): ( call(* getX(..)) || + call(* getY(..)) || + call(* move(..)) ) { + count++; + } +} + diff --git a/tests/base/test101/Pos.java b/tests/base/test101/Pos.java new file mode 100644 index 000000000..b6a70e6ba --- /dev/null +++ b/tests/base/test101/Pos.java @@ -0,0 +1,19 @@ + +class Pos { + + int x = 0; + int y = 0; + + int getX() { + return(x); + } + + int getY() { + return(y); + } + + void move(int newX, int newY) { + x=newX; + y=newY; + } +} diff --git a/tests/base/test101/README b/tests/base/test101/README new file mode 100644 index 000000000..445e688b1 --- /dev/null +++ b/tests/base/test101/README @@ -0,0 +1,4 @@ +Mode: vm run
+Title: before methods, count++, multiple files
+
+Exactly like test001, except this one uses multiple files.
|