diff options
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/methods/same-name.vala | 19 | ||||
-rw-r--r-- | tests/semantic/method-interface-already-found.test | 16 | ||||
-rw-r--r-- | tests/semantic/method-interface-not-found.test | 16 |
4 files changed, 54 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index e9574e09b..830a90472 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -75,6 +75,7 @@ TESTS = \ methods/contains.vala \ methods/iterator.vala \ methods/prepostconditions.vala \ + methods/same-name.vala \ methods/symbolresolution.vala \ methods/bug595538.vala \ methods/bug596726.vala \ @@ -532,6 +533,8 @@ TESTS = \ semantic/method-extern-abstract.test \ semantic/method-extern-body.test \ semantic/method-extern-virtual.test \ + semantic/method-interface-already-found.test \ + semantic/method-interface-not-found.test \ semantic/method-main-async.test \ semantic/method-main-inline.test \ semantic/method-main-throws.test \ diff --git a/tests/methods/same-name.vala b/tests/methods/same-name.vala new file mode 100644 index 000000000..a62a07dd7 --- /dev/null +++ b/tests/methods/same-name.vala @@ -0,0 +1,19 @@ +interface IFoo { + public abstract bool foo (); +} + +class Foo : IFoo { + public bool IFoo.foo () { + return true; + } + + public int foo () { + return 42; + } +} + +void main () { + var foo = new Foo (); + assert (((IFoo) foo).foo ()); + assert (foo.foo () == 42); +} diff --git a/tests/semantic/method-interface-already-found.test b/tests/semantic/method-interface-already-found.test new file mode 100644 index 000000000..47ae22f75 --- /dev/null +++ b/tests/semantic/method-interface-already-found.test @@ -0,0 +1,16 @@ +Invalid Code + +interface IFoo { + public abstract void foo (); +} + +class Foo : IFoo { + public void IFoo.foo () { + } + + public void IFoo.foo () { + } +} + +void main () { +} diff --git a/tests/semantic/method-interface-not-found.test b/tests/semantic/method-interface-not-found.test new file mode 100644 index 000000000..a22278feb --- /dev/null +++ b/tests/semantic/method-interface-not-found.test @@ -0,0 +1,16 @@ +Invalid Code + +interface IFoo { + public abstract void foo (); +} + +class Foo : IFoo { + public void foo () { + } + + public void IFoo.bar () { + } +} + +void main () { +} |