Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Unified Diff: tests/language/src/CompileTimeConstTest.dart

Issue 8231031: Check for compile-time constants in DartCompiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: All tests pass but one junit test Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/language/src/CompileTimeConstTest.dart
diff --git a/tests/language/src/CompileTimeConstTest.dart b/tests/language/src/CompileTimeConstTest.dart
new file mode 100644
index 0000000000000000000000000000000000000000..50097584950ab96850d11f7a7ad19b1ec3140929
--- /dev/null
+++ b/tests/language/src/CompileTimeConstTest.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Exercises language constructs that require compile time constants
+
+final int TOP1 = 1;
+final int TOP2 = TOP1;
+final bool TOP3 = true;
+final String TOP4 = "Hello";
+
+// Binary Expressions
+// Negative Test: final TOP1 = 1; final TOP_BOP1 = TOP1 * 1; // TOP1 isn't type int
+final TOP_BOP1 = TOP1 * 1;
+final TOP_BOP2 = 1 * TOP1;
+final TOP_BOP2_0 = 1 + 3;
+final TOP_BOP2_1 = 2 * (TOP_BOP2_0 - TOP_BOP2);
+
+final TOP_BOP3 = 2 < TOP1;
+final TOP_BOP4 = TOP1 < 2;
+final TOP_BOP5 = 0x80 & 0x04;
+final TOP_BOP6 = TOP3 && true;
+final TOP_BOP7 = false && TOP3;
+final TOP_BOP8 = TOP4 == "World!";
+final bool TOP_BOP9 = "Hello" == TOP4;
+final TOP_BOP10 = TOP1 === TOP2;
+final TOP_BOP11 = TOP3 !== TOP_BOP9;
+// Multiple binary expresions
+final TOP_BOP12 = 1 * TOP1 / 3 + TOP1;
+
+// Parenthized expression
+final TOP_BOP20 = ( 1 > 2 );
+final TOP_BOP21 = (1 * 2) + 3;
+
+
+// Unary expression
+final TOP_BOP22 = !TOP3;
+final TOP_BOP23 = (!TOP3) && true;
+
+
+main () {
+
+}

Powered by Google App Engine
This is Rietveld 408576698