OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library StatusExpressionTest; | 5 library StatusExpressionTest; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import "../../tools/testing/dart/status_expression.dart"; | 8 import "../../tools/testing/dart/status_expression.dart"; |
9 | 9 |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 static void test3() { | 59 static void test3() { |
60 var thrown; | 60 var thrown; |
61 String input = r" $mode == debug && ($arch==chromium || *$arch == dartc)"; | 61 String input = r" $mode == debug && ($arch==chromium || *$arch == dartc)"; |
62 Tokenizer tokenizer = new Tokenizer(input); | 62 Tokenizer tokenizer = new Tokenizer(input); |
63 try { | 63 try { |
64 tokenizer.tokenize(); | 64 tokenizer.tokenize(); |
65 } on Exception catch (e) { | 65 } on Exception catch (e) { |
66 thrown = e; | 66 thrown = e; |
67 } | 67 } |
68 Expect.equals("Syntax error in '$input'", thrown.toString()); | 68 Expect.equals("Exception: Syntax error in '$input'", thrown.toString()); |
69 } | 69 } |
70 | 70 |
71 static void test4() { | 71 static void test4() { |
72 var thrown; | 72 var thrown; |
73 String input = | 73 String input = |
74 r"($arch == (-dartc || $arch == chromium) && $mode == release"; | 74 r"($arch == (-dartc || $arch == chromium) && $mode == release"; |
75 Tokenizer tokenizer = new Tokenizer(input); | 75 Tokenizer tokenizer = new Tokenizer(input); |
76 try { | 76 try { |
77 tokenizer.tokenize(); | 77 tokenizer.tokenize(); |
78 } on Exception catch (e) { | 78 } on Exception catch (e) { |
79 thrown = e; | 79 thrown = e; |
80 } | 80 } |
81 Expect.equals("Syntax error in '$input'", thrown.toString()); | 81 Expect.equals("Exception: Syntax error in '$input'", thrown.toString()); |
82 } | 82 } |
83 | 83 |
84 static void test5() { | 84 static void test5() { |
85 Tokenizer tokenizer = new Tokenizer( | 85 Tokenizer tokenizer = new Tokenizer( |
86 r"Skip , Pass if $arch == dartc, Fail || Timeout if " | 86 r"Skip , Pass if $arch == dartc, Fail || Timeout if " |
87 r"$arch == chromium && $mode == release"); | 87 r"$arch == chromium && $mode == release"); |
88 tokenizer.tokenize(); | 88 tokenizer.tokenize(); |
89 ExpressionParser parser = | 89 ExpressionParser parser = |
90 new ExpressionParser(new Scanner(tokenizer.tokens)); | 90 new ExpressionParser(new Scanner(tokenizer.tokens)); |
91 SetExpression ast = parser.parseSetExpression(); | 91 SetExpression ast = parser.parseSetExpression(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 environment["arch"] = "arm"; | 141 environment["arch"] = "arm"; |
142 Expect.isFalse(ast.evaluate(environment)); | 142 Expect.isFalse(ast.evaluate(environment)); |
143 environment["checked"] = true; | 143 environment["checked"] = true; |
144 Expect.isFalse(ast.evaluate(environment)); | 144 Expect.isFalse(ast.evaluate(environment)); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 main() { | 148 main() { |
149 StatusExpressionTest.testMain(); | 149 StatusExpressionTest.testMain(); |
150 } | 150 } |
OLD | NEW |