Chromium Code Reviews| Index: compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java |
| =================================================================== |
| --- compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java (revision 8813) |
| +++ compiler/javatests/com/google/dart/compiler/resolver/CompileTimeConstantTest.java (working copy) |
| @@ -34,6 +34,31 @@ |
| "}")); |
| } |
| + public void test_nonConstantExpressions() { |
| + resolveAndTestCtConstExpectErrors( |
| + Joiner.on("\n").join( |
| + "class Object {}", |
| +// "void f() {", |
| +// " int x = 0;", |
| +// " const {'$x' : 1};", |
| +// " const {'key': []};", |
| +// " const [new Object()];", |
| +// "}"), |
|
scheglov
2012/06/18 20:51:45
Do we need this commented code?
Brian Wilkerson
2012/06/18 20:53:29
Nope. Just forgot to delete it before uploading. I
|
| + "var x = 0;", |
| + "const c1 = const {'$x' : 1};", |
| + "const c2 = const {'key': []};", |
| + "const c3 = const [new Object()];"), |
| + errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 3, 21, 1), |
| + errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 4, 26,2), |
| + errEx(ResolverErrorCode.EXPECTED_CONSTANT_EXPRESSION, 5, 19, 12)); |
| + } |
| + |
| + public void test_expressionsWithNull() { |
| + resolveAndTestCtConst(Joiner.on("\n").join( |
| + "class Object {}", |
| + "var b = null === '';")); |
| + } |
| + |
| public void test_parameterDefaultValue_inLocalFunction() { |
| resolveAndTestCtConstExpectErrors( |
| Joiner.on("\n").join( |