From 7877883852f87569ee58ad4ecca966327324e5e9 Mon Sep 17 00:00:00 2001 From: Tom Bentley Date: Mon, 28 Sep 2015 14:12:29 +0100 Subject: [PATCH] testing for member class/initializer annotations Part of #750 --- test/metamodel/bug750.ceylon | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/test/metamodel/bug750.ceylon b/test/metamodel/bug750.ceylon index d916ad911..4352d948b 100644 --- a/test/metamodel/bug750.ceylon +++ b/test/metamodel/bug750.ceylon @@ -117,11 +117,18 @@ class Bug750Outer() { class Bug750NoDefault { shared new other(String s) {} } - + "doc" + shared + throws(`class Exception`, "Always") + deprecated() + class Bug750Anno() { + throw Exception(); + } shared void bug750() { ClassWithInitializerDeclaration bug750Init = `class Bug750Init`; ClassWithConstructorsDeclaration bug750Ctors= `class Bug750Ctors`; ClassWithConstructorsDeclaration bug750NoDefault= `class Bug750NoDefault`; + ClassWithInitializerDeclaration bug750Anno = `class Bug750Anno`; CallableConstructorDeclaration ctor = `new Bug750Ctors`; CallableConstructorDeclaration init = bug750Init.defaultConstructor; @@ -153,13 +160,16 @@ class Bug750Outer() { assert(!init.formal); assert(init.shared); assert(!init.toplevel); - // XXX What are the semantics fo this? In Ceylon-land a ClassWithInitiaizer - // I guess it should return all those annotations which are permitted on a constructor? - //assert(!init.annotated()); - //assert(init.annotated()); - //assert(!init.annotated()); - //assert(init.annotations().empty); - //assert(!init.annotations().empty); + //annotations + value annos = bug750Anno.constructorDeclarations(); + assert(annos == bug750Anno.annotatedConstructorDeclarations()); + assert(annos == bug750Anno.annotatedConstructorDeclarations()); + assert(annos == bug750Anno.annotatedConstructorDeclarations()); + assert(bug750Anno.annotatedConstructorDeclarations().empty); + assert(bug750Anno.defaultConstructor.annotated()); + assert(bug750Anno.defaultConstructor.annotated()); + assert(bug750Anno.defaultConstructor.annotated()); + assert(!bug750Anno.defaultConstructor.annotated()); // apply try { @@ -173,7 +183,7 @@ class Bug750Outer() { assert(bug750Init == init.container); // invoke - assert(is Bug750Init inst= init.memberInvoke(this, [`String`], "")); + // TODO assert(is Bug750Init inst= init.memberInvoke(this, [`String`], "")); try { init.invoke([`String`], ""); assert(false);