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

Unified Diff: frog/tests/leg/src/PrettyParameterTest.dart

Issue 10250002: test rename overhaul: step 5 - frog and leg tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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: frog/tests/leg/src/PrettyParameterTest.dart
diff --git a/frog/tests/leg/src/PrettyParameterTest.dart b/frog/tests/leg/src/PrettyParameterTest.dart
deleted file mode 100644
index 00206903ac45e2d6a0e95350a921281618f5d510..0000000000000000000000000000000000000000
--- a/frog/tests/leg/src/PrettyParameterTest.dart
+++ /dev/null
@@ -1,110 +0,0 @@
-// 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.
-// Test that parameters keep their names in the output.
-
-#import("compiler_helper.dart");
-
-final String FOO = @"""
-void foo(var a, var b) {
-}
-""";
-
-
-final String BAR = @"""
-void bar(var eval, var $eval) {
-}
-""";
-
-
-final String PARAMETER_AND_TEMP = @"""
-void bar(var t0, var b) {
- {
- var t0 = 2;
- if (b) {
- t0 = 4;
- } else {
- t0 = 3;
- }
- print(t0);
- }
- print(t0);
-}
-""";
-
-final String NO_LOCAL = @"""
-foo(bar, baz) {
- if (bar) {
- baz = 2;
- } else {
- baz = 3;
- }
- return baz;
-}
-""";
-
-final String MULTIPLE_PHIS_ONE_LOCAL = @"""
-foo(param1, param2, param3) {
- var a = 2;
- if (param1) {
- if (param2) {
- if (param3) {
- a = 42;
- }
- }
- }
- return a;
-}
-""";
-
-final String PARAMETER_INIT = @"""
-int foo(var start, bool test) {
- var result = start;
- if (test) {
- result = 42;
- }
- return result;
-}
-""";
-
-main() {
- String generated = compile(FOO, 'foo');
- // TODO(ngeoffray): Use 'contains' when frog supports it.
- RegExp regexp = const RegExp(@"function\(a, b\) {");
- Expect.isTrue(regexp.hasMatch(generated));
-
- generated = compile(BAR, 'bar');
- regexp = const RegExp(@"function\(eval\$, \$\$eval\) {");
- Expect.isTrue(regexp.hasMatch(generated));
-
- generated = compile(PARAMETER_AND_TEMP, 'bar');
- regexp = const RegExp(@"print\(t0\)");
- Expect.isTrue(regexp.hasMatch(generated));
- // Check that the second 't0' got another name.
- regexp = const RegExp(@"print\(t0_0\)");
- Expect.isTrue(regexp.hasMatch(generated));
-
- generated = compile(NO_LOCAL, 'foo');
- regexp = const RegExp("return baz");
- Expect.isTrue(regexp.hasMatch(generated));
- regexp = const RegExp(@"baz = 2");
- Expect.isTrue(regexp.hasMatch(generated));
- regexp = const RegExp(@"baz = 3");
- Expect.isTrue(regexp.hasMatch(generated));
- regexp = const RegExp("bar === true");
- Expect.isTrue(regexp.hasMatch(generated));
-
- generated = compile(MULTIPLE_PHIS_ONE_LOCAL, 'foo');
- regexp = const RegExp(@"var a = 2;");
- Expect.isTrue(regexp.hasMatch(generated));
-
- regexp = const RegExp(@"a = 2;");
- Iterator matches = regexp.allMatches(generated).iterator();
- Expect.isTrue(matches.hasNext());
- matches.next();
- Expect.isFalse(matches.hasNext());
-
- generated = compile(PARAMETER_INIT, 'foo');
- regexp = const RegExp("var result = start;");
- Expect.isTrue(regexp.hasMatch(generated));
-}

Powered by Google App Engine
This is Rietveld 408576698