| 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("FormatException: Syntax error in '$input'", |
| 69 thrown.toString()); |
| 69 } | 70 } |
| 70 | 71 |
| 71 static void test4() { | 72 static void test4() { |
| 72 var thrown; | 73 var thrown; |
| 73 String input = | 74 String input = |
| 74 r"($arch == (-dartc || $arch == chromium) && $mode == release"; | 75 r"($arch == (-dartc || $arch == chromium) && $mode == release"; |
| 75 Tokenizer tokenizer = new Tokenizer(input); | 76 Tokenizer tokenizer = new Tokenizer(input); |
| 76 try { | 77 try { |
| 77 tokenizer.tokenize(); | 78 tokenizer.tokenize(); |
| 78 } on Exception catch (e) { | 79 } on Exception catch (e) { |
| 79 thrown = e; | 80 thrown = e; |
| 80 } | 81 } |
| 81 Expect.equals("Syntax error in '$input'", thrown.toString()); | 82 Expect.equals("FormatException: Syntax error in '$input'", |
| 83 thrown.toString()); |
| 82 } | 84 } |
| 83 | 85 |
| 84 static void test5() { | 86 static void test5() { |
| 85 Tokenizer tokenizer = new Tokenizer( | 87 Tokenizer tokenizer = new Tokenizer( |
| 86 r"Skip , Pass if $arch == dartc, Fail || Timeout if " | 88 r"Skip , Pass if $arch == dartc, Fail || Timeout if " |
| 87 r"$arch == chromium && $mode == release"); | 89 r"$arch == chromium && $mode == release"); |
| 88 tokenizer.tokenize(); | 90 tokenizer.tokenize(); |
| 89 ExpressionParser parser = | 91 ExpressionParser parser = |
| 90 new ExpressionParser(new Scanner(tokenizer.tokens)); | 92 new ExpressionParser(new Scanner(tokenizer.tokens)); |
| 91 SetExpression ast = parser.parseSetExpression(); | 93 SetExpression ast = parser.parseSetExpression(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 environment["arch"] = "arm"; | 143 environment["arch"] = "arm"; |
| 142 Expect.isFalse(ast.evaluate(environment)); | 144 Expect.isFalse(ast.evaluate(environment)); |
| 143 environment["checked"] = true; | 145 environment["checked"] = true; |
| 144 Expect.isFalse(ast.evaluate(environment)); | 146 Expect.isFalse(ast.evaluate(environment)); |
| 145 } | 147 } |
| 146 } | 148 } |
| 147 | 149 |
| 148 main() { | 150 main() { |
| 149 StatusExpressionTest.testMain(); | 151 StatusExpressionTest.testMain(); |
| 150 } | 152 } |
| OLD | NEW |