| 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("../../tools/testing/dart/status_expression.dart"); | 7 #import("../../tools/testing/dart/status_expression.dart"); |
| 8 | 8 |
| 9 | 9 |
| 10 class StatusExpressionTest { | 10 class StatusExpressionTest { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 ["(", "\$", "arch", "==", "dartc", "||", "\$", "arch", "==", | 54 ["(", "\$", "arch", "==", "dartc", "||", "\$", "arch", "==", |
| 55 "chromium", ")", "&&", "\$", "mode", "==", "release"]); | 55 "chromium", ")", "&&", "\$", "mode", "==", "release"]); |
| 56 } | 56 } |
| 57 | 57 |
| 58 static void test3() { | 58 static void test3() { |
| 59 var thrown; | 59 var thrown; |
| 60 String input = @" $mode == debug && ($arch==chromium || *$arch == dartc)"; | 60 String input = @" $mode == debug && ($arch==chromium || *$arch == dartc)"; |
| 61 Tokenizer tokenizer = new Tokenizer(input); | 61 Tokenizer tokenizer = new Tokenizer(input); |
| 62 try { | 62 try { |
| 63 tokenizer.tokenize(); | 63 tokenizer.tokenize(); |
| 64 } catch (Exception e) { | 64 } on Exception catch (e) { |
| 65 thrown = e; | 65 thrown = e; |
| 66 } | 66 } |
| 67 Expect.equals("Syntax error in '$input'", thrown.toString()); | 67 Expect.equals("Syntax error in '$input'", thrown.toString()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 static void test4() { | 70 static void test4() { |
| 71 var thrown; | 71 var thrown; |
| 72 String input = | 72 String input = |
| 73 @"($arch == (-dartc || $arch == chromium) && $mode == release"; | 73 @"($arch == (-dartc || $arch == chromium) && $mode == release"; |
| 74 Tokenizer tokenizer = new Tokenizer(input); | 74 Tokenizer tokenizer = new Tokenizer(input); |
| 75 try { | 75 try { |
| 76 tokenizer.tokenize(); | 76 tokenizer.tokenize(); |
| 77 } catch (Exception e) { | 77 } on Exception catch (e) { |
| 78 thrown = e; | 78 thrown = e; |
| 79 } | 79 } |
| 80 Expect.equals("Syntax error in '$input'", thrown.toString()); | 80 Expect.equals("Syntax error in '$input'", thrown.toString()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static void test5() { | 83 static void test5() { |
| 84 Tokenizer tokenizer = new Tokenizer( | 84 Tokenizer tokenizer = new Tokenizer( |
| 85 @"Skip , Pass if $arch == dartc, Fail || Timeout if " | 85 @"Skip , Pass if $arch == dartc, Fail || Timeout if " |
| 86 @"$arch == chromium && $mode == release"); | 86 @"$arch == chromium && $mode == release"); |
| 87 tokenizer.tokenize(); | 87 tokenizer.tokenize(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 environment["arch"] = "arm"; | 140 environment["arch"] = "arm"; |
| 141 Expect.isFalse(ast.evaluate(environment)); | 141 Expect.isFalse(ast.evaluate(environment)); |
| 142 environment["checked"] = true; | 142 environment["checked"] = true; |
| 143 Expect.isFalse(ast.evaluate(environment)); | 143 Expect.isFalse(ast.evaluate(environment)); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 main() { | 147 main() { |
| 148 StatusExpressionTest.testMain(); | 148 StatusExpressionTest.testMain(); |
| 149 } | 149 } |
| OLD | NEW |