diff --git a/tests/language/string_intrinsics_test.dart b/tests/language/string_intrinsics_test.dart deleted file mode 100644 index faa672fdab7..00000000000 --- a/tests/language/string_intrinsics_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2012, 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. -// Replace with shared test once interface issues clarified. -// Test various String intrinsics -// VMOptions=--optimization-counter-threshold=10 --no-background-compilation - -import "package:expect/expect.dart"; - -main() { - var oneByte = "Hello world"; - var empty = ""; - for (int i = 0; i < 20; i++) { - Expect.equals(11, testLength(oneByte)); - Expect.equals(0, testLength(empty)); - Expect.isFalse(testIsEmpty(oneByte)); - Expect.isTrue(testIsEmpty(empty)); - } -} - -testLength(s) { - return s.length; -} - -testIsEmpty(s) { - return s.isEmpty; -} diff --git a/tests/language/string_optimizations_test.dart b/tests/language/string_optimizations_test.dart deleted file mode 100644 index f5e1b0ff27b..00000000000 --- a/tests/language/string_optimizations_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2013, 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. - -// Regression test for dart2js's type inferrer, that used to not -// correctly infer optional named parameters. - -import "package:expect/expect.dart"; -import "compiler_annotations.dart"; - -@DontInline() -foo({path}) { - () => 42; - return path.toString(); -} - -@DontInline() -bar({path}) { - () => 42; - return path; -} - -main() { - var a = [foo(path: '42'), foo(), 42, bar(path: '54')]; - Expect.isTrue(a[1] is String); - Expect.throws(() => bar().concat('54'), (e) => e is NoSuchMethodError); -} diff --git a/tests/language/string_unicode4_negative_test.dart b/tests/language/string_unicode4_negative_test.dart deleted file mode 100644 index c7bdf6002bc..00000000000 --- a/tests/language/string_unicode4_negative_test.dart +++ /dev/null @@ -1,15 +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. - -class StringUnicode4NegativeTest { - - static testMain() { - // Unicode escapes must refer to valid Unicode points. - String str = "Foo\u{FFFFFF}"; - } -} - -main() { - StringUnicode4NegativeTest.testMain(); -} diff --git a/tests/language/super_bound_closure_test.dart b/tests/language/super_bound_closure_test.dart deleted file mode 100644 index 279c8388689..00000000000 --- a/tests/language/super_bound_closure_test.dart +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2014, 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. - -import "package:expect/expect.dart"; - -@AssumeDynamic() -@NoInline() -confuse(x) => x; - -class A { - bar([var optional = 1]) => 498 + optional; - bar2({namedOptional: 2}) => 40 + namedOptional; - bar3(x, [var optional = 3]) => x + 498 + optional; - bar4(x, {namedOptional: 4}) => 422 + x + namedOptional; - - // Gee is the same as bar, but we make sure that gee is used. Potentially - // this yields different code if the redirecting stub exists. - gee([var optional = 1]) => 498 + optional; - gee2({namedOptional: 2}) => 40 + namedOptional; - gee3(x, [var optional = 3]) => x + 498 + optional; - gee4(x, {namedOptional: 4}) => 422 + x + namedOptional; - - // Use identifiers that could be intercepted. - add([var optional = 33]) => 1234 + optional; - trim({namedOptional: 22}) => 1313 + namedOptional; - sublist(x, [optional = 44]) => 4321 + optional + x; - splitMapJoin(x, {onMatch: 55, onNonMatch: 66}) => - 111 + x + onMatch + onNonMatch; - - // Other interceptable identifiers, but all of them are used. - shuffle([var optional = 121]) => 12342 + optional; - toList({growable: 2233}) => 13131 + growable; - lastIndexOf(x, [optional = 424]) => 14321 + optional + x; - lastWhere(x, {orElse: 555}) => x + 1213 + 555; -} - -class B extends A { - // The closure `super.bar` is invoked without the optional argument. - // Dart2js must not generate a `bar$0 => bar$1(null)` closure, since that - // would redirect to B's `bar$1`. Instead it must enforce that `bar$0` in - // `A` redirects to A's bar$1. - foo() => confuse(super.bar)(); - foo2() => confuse(super.bar)(2); - foo3() => confuse(super.bar2)(); - foo4() => confuse(super.bar2)(namedOptional: 77); - foo5() => confuse(super.bar3)(-3); - foo6() => confuse(super.bar3)(-11, -19); - foo7() => confuse(super.bar4)(0); - foo8() => confuse(super.bar4)(3, namedOptional: 77); - - fooGee() => confuse(super.gee)(); - fooGee2() => confuse(super.gee)(2); - fooGee3() => confuse(super.gee2)(); - fooGee4() => confuse(super.gee2)(namedOptional: 77); - fooGee5() => confuse(super.gee3)(-3); - fooGee6() => confuse(super.gee3)(-11, -19); - fooGee7() => confuse(super.gee4)(0); - fooGee8() => confuse(super.gee4)(3, namedOptional: 77); - - fooIntercept() => confuse(super.add)(); - fooIntercept2() => confuse(super.add)(2); - fooIntercept3() => confuse(super.trim)(); - fooIntercept4() => confuse(super.trim)(namedOptional: 77); - fooIntercept5() => confuse(super.sublist)(-3); - fooIntercept6() => confuse(super.sublist)(-11, -19); - fooIntercept7() => confuse(super.splitMapJoin)(0); - fooIntercept8() => confuse(super.splitMapJoin)(3, onMatch: 77, onNonMatch: 8); - - fooIntercept21() => confuse(super.shuffle)(); - fooIntercept22() => confuse(super.shuffle)(2); - fooIntercept23() => confuse(super.toList)(); - fooIntercept24() => confuse(super.toList)(growable: 77); - fooIntercept25() => confuse(super.lastIndexOf)(-3); - fooIntercept26() => confuse(super.lastIndexOf)(-11, -19); - fooIntercept27() => confuse(super.lastWhere)(0); - fooIntercept28() => confuse(super.lastWhere)(3, orElse: 77); - - bar([var optional]) => -1; // //# 01: static type warning - bar2({ namedOptional }) => -1; // //# 01: continued - bar3(x, [var optional]) => -1; // //# 01: continued - bar4(x, { namedOptional }) => -1; //# 01: continued - - gee([var optional]) => -1; // //# 01: continued - gee2({ namedOptional }) => -1; // //# 01: continued - gee3(x, [var optional]) => -1; // //# 01: continued - gee4(x, { namedOptional }) => -1; //# 01: continued - - add([var optional = 33]) => -1; - trim({namedOptional: 22}) => -1; - sublist(x, [optional = 44]) => -1; - splitMapJoin(x, {onMatch: 55, onNonMatch: 66}) => -1; - - shuffle([var optional = 121]) => -1; - toList({growable: 2233}) => -1; - lastIndexOf(x, [optional = 424]) => -1; - lastWhere(x, {orElse: 555}) => -1; -} - -main() { - var list = [new A(), new B(), [], "foo"]; - var a = list[confuse(0)]; - var b = list[confuse(1)]; - var ignored = list[confuse(2)]; - var ignored2 = list[confuse(3)]; - - var t = b.gee() + b.gee2() + b.gee3(9) + b.gee4(19); - Expect.equals(-4, t); //# 01: continued - t = b.shuffle() + b.toList() + b.lastIndexOf(1) + b.lastWhere(2); - Expect.equals(-4, t); - - Expect.equals(499, b.foo()); // //# 01: continued - Expect.equals(500, b.foo2()); //# 01: continued - Expect.equals(42, b.foo3()); // //# 01: continued - Expect.equals(117, b.foo4()); //# 01: continued - Expect.equals(498, b.foo5()); //# 01: continued - Expect.equals(468, b.foo6()); //# 01: continued - Expect.equals(426, b.foo7()); //# 01: continued - Expect.equals(502, b.foo8()); //# 01: continued - - Expect.equals(499, b.fooGee()); // //# 01: continued - Expect.equals(500, b.fooGee2()); //# 01: continued - Expect.equals(42, b.fooGee3()); // //# 01: continued - Expect.equals(117, b.fooGee4()); //# 01: continued - Expect.equals(498, b.fooGee5()); //# 01: continued - Expect.equals(468, b.fooGee6()); //# 01: continued - Expect.equals(426, b.fooGee7()); //# 01: continued - Expect.equals(502, b.fooGee8()); //# 01: continued - - Expect.equals(1267, b.fooIntercept()); - Expect.equals(1236, b.fooIntercept2()); - Expect.equals(1335, b.fooIntercept3()); - Expect.equals(1390, b.fooIntercept4()); - Expect.equals(4362, b.fooIntercept5()); - Expect.equals(4291, b.fooIntercept6()); - Expect.equals(232, b.fooIntercept7()); - Expect.equals(199, b.fooIntercept8()); - - Expect.equals(12463, b.fooIntercept21()); - Expect.equals(12344, b.fooIntercept22()); - Expect.equals(15364, b.fooIntercept23()); - Expect.equals(13208, b.fooIntercept24()); - Expect.equals(14742, b.fooIntercept25()); - Expect.equals(14291, b.fooIntercept26()); - Expect.equals(1768, b.fooIntercept27()); - Expect.equals(1771, b.fooIntercept28()); -} diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status index 8170f3944f3..ae5a8940f6b 100644 --- a/tests/language_2/language_2_analyzer.status +++ b/tests/language_2/language_2_analyzer.status @@ -162,7 +162,13 @@ static_getter_no_setter2_test/01: MissingCompileTimeError static_getter_no_setter3_test/01: MissingCompileTimeError static_setter_get_test/01: MissingCompileTimeError static_initializer_type_error_test: MissingCompileTimeError -string_interpolate_test: StaticWarning +string_interpolate_test: MissingCompileTimeError +string_test/01: MissingCompileTimeError +string_unicode1_negative_test: CompileTimeError +string_unicode2_negative_test: CompileTimeError +string_unicode3_negative_test: CompileTimeError +string_unicode4_negative_test: CompileTimeError +super_bound_closure_test/01: MissingCompileTimeError type_variable_static_context_test: MissingCompileTimeError [ $compiler == dart2analyzer && ! $strong && $checked ] @@ -292,7 +298,13 @@ static_getter_no_setter2_test/01: MissingCompileTimeError static_getter_no_setter3_test/01: MissingCompileTimeError static_setter_get_test/01: MissingCompileTimeError static_initializer_type_error_test: MissingCompileTimeError -string_interpolate_test: StaticWarning +string_interpolate_test: MissingCompileTimeError +string_test/01: MissingCompileTimeError +string_unicode1_negative_test: CompileTimeError +string_unicode2_negative_test: CompileTimeError +string_unicode3_negative_test: CompileTimeError +string_unicode4_negative_test: CompileTimeError +super_bound_closure_test/01: MissingCompileTimeError type_variable_static_context_test: MissingCompileTimeError [ $compiler == dart2analyzer ] @@ -372,6 +384,13 @@ generics_test: CompileTimeError import_core_prefix_test: CompileTimeError # "dynamic" should be defined in core. multiple_interface_inheritance_test: CompileTimeError # Issue 30552 regress_30339_test: CompileTimeError +string_supertype_checked_test: CompileTimeError +string_unicode1_negative_test: CompileTimeError +string_unicode2_negative_test: CompileTimeError +string_unicode3_negative_test: CompileTimeError +string_unicode4_negative_test: CompileTimeError +string_split_test: CompileTimeError +super_bound_closure_test/none: CompileTimeError vm/lazy_deopt_with_exception*: CompileTimeError void_type_function_types_test/none: CompileTimeError # Issue 30177 void_type_usage_test/param_as: CompileTimeError # Issue 30177 @@ -521,6 +540,26 @@ named_parameters_test/10: MissingCompileTimeError named_parameters_type_test/01: MissingCompileTimeError named_parameters_type_test/02: MissingCompileTimeError named_parameters_type_test/03: MissingCompileTimeError +string_interpolation_test/01: MissingCompileTimeError +string_no_operator_test/01: MissingCompileTimeError +string_no_operator_test/02: MissingCompileTimeError +string_no_operator_test/03: MissingCompileTimeError +string_no_operator_test/04: MissingCompileTimeError +string_no_operator_test/05: MissingCompileTimeError +string_no_operator_test/06: MissingCompileTimeError +string_no_operator_test/07: MissingCompileTimeError +string_no_operator_test/08: MissingCompileTimeError +string_no_operator_test/09: MissingCompileTimeError +string_no_operator_test/10: MissingCompileTimeError +string_no_operator_test/11: MissingCompileTimeError +string_no_operator_test/12: MissingCompileTimeError +string_no_operator_test/13: MissingCompileTimeError +string_no_operator_test/14: MissingCompileTimeError +string_no_operator_test/15: MissingCompileTimeError +string_no_operator_test/16: MissingCompileTimeError +string_test/01: MissingCompileTimeError +super_assign_test/01: MissingCompileTimeError +substring_test/01: MissingCompileTimeError type_variable_scope_test/00: MissingCompileTimeError type_variable_scope_test/01: MissingCompileTimeError type_variable_scope_test/02: MissingCompileTimeError diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status index fdfa4efe742..ef3c6300069 100644 --- a/tests/language_2/language_2_dart2js.status +++ b/tests/language_2/language_2_dart2js.status @@ -224,6 +224,27 @@ static_getter_no_setter1_test/01: MissingCompileTimeError static_getter_no_setter2_test/01: MissingCompileTimeError static_initializer_type_error_test: MissingCompileTimeError static_setter_get_test/01: MissingCompileTimeError +string_interpolation_test/01: MissingCompileTimeError +string_no_operator_test/01: MissingCompileTimeError +string_no_operator_test/02: MissingCompileTimeError +string_no_operator_test/03: MissingCompileTimeError +string_no_operator_test/04: MissingCompileTimeError +string_no_operator_test/05: MissingCompileTimeError +string_no_operator_test/06: MissingCompileTimeError +string_no_operator_test/07: MissingCompileTimeError +string_no_operator_test/08: MissingCompileTimeError +string_no_operator_test/09: MissingCompileTimeError +string_no_operator_test/10: MissingCompileTimeError +string_no_operator_test/11: MissingCompileTimeError +string_no_operator_test/12: MissingCompileTimeError +string_no_operator_test/13: MissingCompileTimeError +string_no_operator_test/14: MissingCompileTimeError +string_no_operator_test/15: MissingCompileTimeError +string_no_operator_test/16: MissingCompileTimeError +string_test/01: MissingCompileTimeError +substring_test/01: MissingCompileTimeError +super_assign_test/01: MissingCompileTimeError +super_bound_closure_test/01: MissingCompileTimeError type_variable_nested_test/01: RuntimeError type_variable_promotion_test: RuntimeError type_variable_scope_test/00: MissingCompileTimeError diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status index 21ca83b8996..dfb715c87f4 100644 --- a/tests/language_2/language_2_dartdevc.status +++ b/tests/language_2/language_2_dartdevc.status @@ -56,6 +56,11 @@ accessor_conflict_import_prefixed_test: CompileTimeError # Issue 25626 accessor_conflict_import_test: CompileTimeError # Issue 25626 const_objects_are_immutable_test: RuntimeError # Issue 29897 regress_30339_test: CompileTimeError # As expected. Should we make this a multi test? +string_interpolation_and_buffer_test: RuntimeError +string_literals_test: RuntimeError +string_split_test: CompileTimeError +string_supertype_checked_test: CompileTimeError +super_bound_closure_test/none: CompileTimeError void_type_callbacks_test/00: MissingCompileTimeError # Issue 30514 void_type_callbacks_test/01: MissingCompileTimeError # Issue 30514 void_type_function_types_test/none: CompileTimeError # Issue 30514 diff --git a/tests/language_2/language_2_precompiled.status b/tests/language_2/language_2_precompiled.status index 52fbb8e7cd2..d2fe4cba823 100644 --- a/tests/language_2/language_2_precompiled.status +++ b/tests/language_2/language_2_precompiled.status @@ -223,6 +223,27 @@ named_parameters_test/10: MissingCompileTimeError named_parameters_type_test/01: MissingCompileTimeError named_parameters_type_test/02: MissingCompileTimeError named_parameters_type_test/03: MissingCompileTimeError +string_interpolation_test/01: MissingCompileTimeError +string_no_operator_test/01: MissingCompileTimeError +string_no_operator_test/02: MissingCompileTimeError +string_no_operator_test/03: MissingCompileTimeError +string_no_operator_test/04: MissingCompileTimeError +string_no_operator_test/05: MissingCompileTimeError +string_no_operator_test/06: MissingCompileTimeError +string_no_operator_test/07: MissingCompileTimeError +string_no_operator_test/08: MissingCompileTimeError +string_no_operator_test/09: MissingCompileTimeError +string_no_operator_test/10: MissingCompileTimeError +string_no_operator_test/11: MissingCompileTimeError +string_no_operator_test/12: MissingCompileTimeError +string_no_operator_test/13: MissingCompileTimeError +string_no_operator_test/14: MissingCompileTimeError +string_no_operator_test/15: MissingCompileTimeError +string_no_operator_test/16: MissingCompileTimeError +string_test/01: MissingCompileTimeError +substring_test/01: MissingCompileTimeError +super_assign_test/01: MissingCompileTimeError +super_bound_closure_test/01: MissingCompileTimeError type_variable_nested_test/01: RuntimeError type_variable_promotion_test: RuntimeError static_field3_test/01: MissingCompileTimeError diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status index 670ec3b61f6..cd3cf2e946e 100644 --- a/tests/language_2/language_2_vm.status +++ b/tests/language_2/language_2_vm.status @@ -237,6 +237,27 @@ static_getter_no_setter1_test/01: MissingCompileTimeError static_getter_no_setter2_test/01: MissingCompileTimeError static_initializer_type_error_test: MissingCompileTimeError static_setter_get_test/01: MissingCompileTimeError +string_interpolation_test/01: MissingCompileTimeError +string_no_operator_test/01: MissingCompileTimeError +string_no_operator_test/02: MissingCompileTimeError +string_no_operator_test/03: MissingCompileTimeError +string_no_operator_test/04: MissingCompileTimeError +string_no_operator_test/05: MissingCompileTimeError +string_no_operator_test/06: MissingCompileTimeError +string_no_operator_test/07: MissingCompileTimeError +string_no_operator_test/08: MissingCompileTimeError +string_no_operator_test/09: MissingCompileTimeError +string_no_operator_test/10: MissingCompileTimeError +string_no_operator_test/11: MissingCompileTimeError +string_no_operator_test/12: MissingCompileTimeError +string_no_operator_test/13: MissingCompileTimeError +string_no_operator_test/14: MissingCompileTimeError +string_no_operator_test/15: MissingCompileTimeError +string_no_operator_test/16: MissingCompileTimeError +string_test/01: MissingCompileTimeError +substring_test/01: MissingCompileTimeError +super_assign_test/01: MissingCompileTimeError +super_bound_closure_test/01: MissingCompileTimeError type_variable_nested_test/01: RuntimeError type_variable_promotion_test: RuntimeError type_variable_scope_test/00: MissingCompileTimeError diff --git a/tests/language_strong/string_interpolation1_negative_test.dart b/tests/language_2/string_interpolation1_test.dart similarity index 79% rename from tests/language_strong/string_interpolation1_negative_test.dart rename to tests/language_2/string_interpolation1_test.dart index 15ccfe42291..dacdbca088c 100644 --- a/tests/language_strong/string_interpolation1_negative_test.dart +++ b/tests/language_2/string_interpolation1_test.dart @@ -11,8 +11,9 @@ class A { class StringInterpolation1NegativeTest { // Dollar not followed by "{" or identifier. - static const DOLLAR = const A("$"); - testMain() { + static const DOLLAR = const A("$"); //# 01: compile-time error + static testMain() { + print(DOLLAR); //# 01: continued } } diff --git a/tests/language_strong/string_interpolation2_negative_test.dart b/tests/language_2/string_interpolation2_test.dart similarity index 77% rename from tests/language_strong/string_interpolation2_negative_test.dart rename to tests/language_2/string_interpolation2_test.dart index ca5e269dedd..f54fc950814 100644 --- a/tests/language_strong/string_interpolation2_negative_test.dart +++ b/tests/language_2/string_interpolation2_test.dart @@ -5,8 +5,9 @@ // A dollar must be followed by a "{" or an identifier. class StringInterpolation2NegativeTest { - testMain() { - print('C;Y1;X4;K"$/Month"'); // Dollar followed by "/". + static testMain() { + // Dollar followed by "/". + print('C;Y1;X4;K"$/Month"'); //# 01: compile-time error } } diff --git a/tests/language_strong/string_interpolation3_negative_test.dart b/tests/language_2/string_interpolation3_test.dart similarity index 82% rename from tests/language_strong/string_interpolation3_negative_test.dart rename to tests/language_2/string_interpolation3_test.dart index 14e2525f7d5..59a5001882c 100644 --- a/tests/language_strong/string_interpolation3_negative_test.dart +++ b/tests/language_2/string_interpolation3_test.dart @@ -6,7 +6,8 @@ class StringInterpolation3NegativeTest { static testMain() { - print('F;P4;F$2R'); // Dollar followed by a number. + // Dollar followed by a number. + print('F;P4;F$2R'); //# 01: compile-time error } } diff --git a/tests/language_strong/string_interpolation4_negative_test.dart b/tests/language_2/string_interpolation4_test.dart similarity index 84% rename from tests/language_strong/string_interpolation4_negative_test.dart rename to tests/language_2/string_interpolation4_test.dart index bc7db6f933f..d343e432a99 100644 --- a/tests/language_strong/string_interpolation4_negative_test.dart +++ b/tests/language_2/string_interpolation4_test.dart @@ -5,9 +5,9 @@ // A dollar must be followed by a "{" or an identifier. class StringInterpolation4NegativeTest { - testMain() { + static testMain() { // Dollar not followed by "{" or identifier. - print("-" + "$" + "foo"); + print("-" + "$" + "foo"); //# 01: compile-time error } } diff --git a/tests/language_strong/string_interpolation5_negative_test.dart b/tests/language_2/string_interpolation5_test.dart similarity index 78% rename from tests/language_strong/string_interpolation5_negative_test.dart rename to tests/language_2/string_interpolation5_test.dart index 9d6197d2802..50fba925337 100644 --- a/tests/language_strong/string_interpolation5_negative_test.dart +++ b/tests/language_2/string_interpolation5_test.dart @@ -5,8 +5,9 @@ // A dollar must be followed by a "{" or an identifier. class StringInterpolation5NegativeTest { - testMain() { - print("$1,000"); // Dollar followed by a number. + static testMain() { + // Dollar followed by a number. + print("$1,000"); //# 01: compile-time error } } diff --git a/tests/language_strong/string_interpolation6_negative_test.dart b/tests/language_2/string_interpolation6_test.dart similarity index 80% rename from tests/language_strong/string_interpolation6_negative_test.dart rename to tests/language_2/string_interpolation6_test.dart index e90545fc1b1..35a5b85195c 100644 --- a/tests/language_strong/string_interpolation6_negative_test.dart +++ b/tests/language_2/string_interpolation6_test.dart @@ -5,9 +5,10 @@ // A dollar must be followed by a "{" or an identifier. class StringInterpolation6NegativeTest { - testMain() { + static testMain() { // Dollar not followed by "{" or identifier. - String regexp = "^(\\d\\d?)[-/](\\d\\d?)$"; + String regexp; + regexp = "^(\\d\\d?)[-/](\\d\\d?)$"; //# 01: compile-time error print(regexp); } } diff --git a/tests/language_strong/string_interpolation7_test.dart b/tests/language_2/string_interpolation7_test.dart similarity index 100% rename from tests/language_strong/string_interpolation7_test.dart rename to tests/language_2/string_interpolation7_test.dart diff --git a/tests/language_strong/string_interpolation8_test.dart b/tests/language_2/string_interpolation8_test.dart similarity index 100% rename from tests/language_strong/string_interpolation8_test.dart rename to tests/language_2/string_interpolation8_test.dart diff --git a/tests/language_strong/string_interpolation9_test.dart b/tests/language_2/string_interpolation9_test.dart similarity index 100% rename from tests/language_strong/string_interpolation9_test.dart rename to tests/language_2/string_interpolation9_test.dart diff --git a/tests/language_strong/string_interpolation_and_buffer_test.dart b/tests/language_2/string_interpolation_and_buffer_test.dart similarity index 57% rename from tests/language_strong/string_interpolation_and_buffer_test.dart rename to tests/language_2/string_interpolation_and_buffer_test.dart index 7f72246747b..60b680c16da 100644 --- a/tests/language_strong/string_interpolation_and_buffer_test.dart +++ b/tests/language_2/string_interpolation_and_buffer_test.dart @@ -17,34 +17,13 @@ class ToStringWrapper { wrap(value) => new ToStringWrapper(value); -final bool checkedMode = computeCheckedMode(); -bool computeCheckedMode() { - try { - var i = 42; - String s = i; - } on TypeError catch (e) { - return true; - } - return false; -} - main() { interpolate(object) { var result; - if (checkedMode && object != null) { - try { - result = '${wrap(object)}'; - } on TypeError { - return 'Error'; - } on ArgumentError { - return 'Error'; // Checked mode. - } - } else { - try { - result = '${wrap(object)}'; - } on ArgumentError { - return 'Error'; - } + try { + result = '${wrap(object)}'; + } on ArgumentError { + return 'Error'; } Expect.isTrue(result is String); return 'Success'; @@ -52,20 +31,12 @@ main() { buffer(object) { var sb; - if (checkedMode && object != null) { - try { - sb = new StringBuffer()..write(wrap(object)); - } on TypeError { - return 'Error'; - } on ArgumentError { - return 'Error'; // Checked mode. - } - } else { - try { - sb = new StringBuffer()..write(wrap(object)); - } on ArgumentError { - return 'Error'; - } + try { + sb = new StringBuffer()..write(wrap(object)); + } on ArgumentError { + return 'Error'; + } + if (object == null) { Expect.isTrue(sb.toString() is String); } return 'Success'; @@ -73,20 +44,12 @@ main() { initBuffer(object) { var sb; - if (checkedMode && object != null) { - try { - sb = new StringBuffer(wrap(object)); - } on TypeError { - return 'Error'; - } on ArgumentError { - return 'Error'; // Checked mode. - } - } else { - try { - sb = new StringBuffer(wrap(object)); - } on ArgumentError { - return 'Error'; - } + try { + sb = new StringBuffer(wrap(object)); + } on ArgumentError { + return 'Error'; + } + if (object == null) { Expect.isTrue(sb.toString() is String); } return 'Success'; diff --git a/tests/language_strong/string_interpolation_newline_test.dart b/tests/language_2/string_interpolation_newline_test.dart similarity index 100% rename from tests/language_strong/string_interpolation_newline_test.dart rename to tests/language_2/string_interpolation_newline_test.dart diff --git a/tests/language_strong/string_interpolation_test.dart b/tests/language_2/string_interpolation_test.dart similarity index 97% rename from tests/language_strong/string_interpolation_test.dart rename to tests/language_2/string_interpolation_test.dart index ae9975024e5..af3a28ae074 100644 --- a/tests/language_strong/string_interpolation_test.dart +++ b/tests/language_2/string_interpolation_test.dart @@ -58,7 +58,7 @@ class StringInterpolationTest { Expect.equals("}", "escaped \${3+2}"[17]); if (alwaysFalse) { - "${i.toHorse()}"; //# 01: static type warning + "${i.toHorse()}"; //# 01: compile-time error } Expect.equals("${m}", "$m"); diff --git a/tests/language_strong/string_intrinsics_test.dart b/tests/language_2/string_intrinsics_test.dart similarity index 100% rename from tests/language_strong/string_intrinsics_test.dart rename to tests/language_2/string_intrinsics_test.dart diff --git a/tests/language_strong/string_join_test.dart b/tests/language_2/string_join_test.dart similarity index 100% rename from tests/language_strong/string_join_test.dart rename to tests/language_2/string_join_test.dart diff --git a/tests/language_2/string_literals_test.dart b/tests/language_2/string_literals_test.dart new file mode 100644 index 00000000000..6b4f4f50706 --- /dev/null +++ b/tests/language_2/string_literals_test.dart @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 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. + +import "package:expect/expect.dart"; + +main() { + var expect = new String.fromCharCodes( + [0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff]); + test(string) { + Expect.equals(expect, string); + } + + // Plain escapes of code points. + test("\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}"); + test("""\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}"""); + test('\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}'); + test('''\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}'''); + // Plain escapes of individual code units. + test("\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff"); + test("""\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff"""); + test('\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff'); + test('''\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff'''); + // Insert newline into multiline string. + test("""\x00 +\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff"""); + test('''\x00 +\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff'''); + // Extract code points from multi-character escape string. + test("\x00\x0a\x0d\x7f\xff\uffff" + "${"\u{10000}"[0]}${"\u{10000}"[1]}" + "${"\u{10FFFF}"[0]}${"\u{10FFFF}"[1]}"); + test("\x00\x0a\x0d\x7f\xff\uffff" + "\ud800" + "\udc00\udbff" + "\udfff"); + // Single line string over multiple lines with newlines inside interpolation. + test("\x00\x0a\x0d\x7f\xff${ + "" + }\uffff\ud800\udc00\udbff\udfff"); +} diff --git a/tests/language_2/string_no_operator_test.dart b/tests/language_2/string_no_operator_test.dart new file mode 100644 index 00000000000..85ffe169e76 --- /dev/null +++ b/tests/language_2/string_no_operator_test.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2015, 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. + +import 'package:expect/expect.dart'; + +main() { + var x = "x"; + var y = "y"; + Expect.throws(() => x < y); //# 01: compile-time error + Expect.throws(() => x <= y); //# 02: compile-time error + Expect.throws(() => x > y); //# 03: compile-time error + Expect.throws(() => x >= y); //# 04: compile-time error + Expect.throws(() => x - y); //# 05: compile-time error + Expect.throws(() => x * y); //# 06: compile-time error + Expect.throws(() => x / y); //# 07: compile-time error + Expect.throws(() => x ~/ y); //# 08: compile-time error + Expect.throws(() => x % y); //# 09: compile-time error + Expect.throws(() => x >> y); //# 10: compile-time error + Expect.throws(() => x << y); //# 11: compile-time error + Expect.throws(() => x & y); //# 12: compile-time error + Expect.throws(() => x | y); //# 13: compile-time error + Expect.throws(() => x ^ y); //# 14: compile-time error + Expect.throws(() => -x); //# 15: compile-time error + Expect.throws(() => ~x); //# 16: compile-time error +} diff --git a/tests/language_strong/string_optimizations_test.dart b/tests/language_2/string_optimizations_test.dart similarity index 100% rename from tests/language_strong/string_optimizations_test.dart rename to tests/language_2/string_optimizations_test.dart diff --git a/tests/language_strong/string_overflow.dart b/tests/language_2/string_overflow.dart similarity index 100% rename from tests/language_strong/string_overflow.dart rename to tests/language_2/string_overflow.dart diff --git a/tests/language_strong/string_split_test.dart b/tests/language_2/string_split_test.dart similarity index 84% rename from tests/language_strong/string_split_test.dart rename to tests/language_2/string_split_test.dart index c3c10d659a7..5ec2b374813 100644 --- a/tests/language_strong/string_split_test.dart +++ b/tests/language_2/string_split_test.dart @@ -8,7 +8,7 @@ import "package:expect/expect.dart"; class EvilMatch implements Match { int get start => 100000000; int get end => 3; - bool noSuchMethod(Invocation im) {} // To appease dartanalyzer. + bool noSuchMethod(Invocation im) => false; // To appease dartanalyzer. } class EvilIterator implements Iterator { @@ -22,7 +22,7 @@ class EvilIterable extends Iterable { class EvilPattern implements Pattern { Iterable allMatches(String s, [int start = 0]) => new EvilIterable(); - bool noSuchMethod(Invocation im) {} // To appease dartanalyzer. + bool noSuchMethod(Invocation im) => false; // To appease dartanalyzer. } void main() { diff --git a/tests/language_strong/string_supertype_checked_test.dart b/tests/language_2/string_supertype_checked_test.dart similarity index 100% rename from tests/language_strong/string_supertype_checked_test.dart rename to tests/language_2/string_supertype_checked_test.dart diff --git a/tests/language_strong/string_test.dart b/tests/language_2/string_test.dart similarity index 84% rename from tests/language_strong/string_test.dart rename to tests/language_2/string_test.dart index 37183555b40..eb7cbc14100 100644 --- a/tests/language_strong/string_test.dart +++ b/tests/language_2/string_test.dart @@ -31,13 +31,7 @@ class StringTest { static testNoSuchMethod() { String a = "Hello"; - bool exception_caught = false; - try { - a[1] = 12; // Throw exception. - } on NoSuchMethodError catch (e) { - exception_caught = true; - } - Expect.equals(true, exception_caught); + a[1] = 12; //# 01: compile-time error } static testCharCodes() { diff --git a/tests/language_strong/string_unicode1_negative_test.dart b/tests/language_2/string_unicode1_negative_test.dart similarity index 100% rename from tests/language_strong/string_unicode1_negative_test.dart rename to tests/language_2/string_unicode1_negative_test.dart diff --git a/tests/language_strong/string_unicode2_negative_test.dart b/tests/language_2/string_unicode2_negative_test.dart similarity index 100% rename from tests/language_strong/string_unicode2_negative_test.dart rename to tests/language_2/string_unicode2_negative_test.dart diff --git a/tests/language_strong/string_unicode3_negative_test.dart b/tests/language_2/string_unicode3_negative_test.dart similarity index 100% rename from tests/language_strong/string_unicode3_negative_test.dart rename to tests/language_2/string_unicode3_negative_test.dart diff --git a/tests/language_strong/string_unicode4_negative_test.dart b/tests/language_2/string_unicode4_negative_test.dart similarity index 100% rename from tests/language_strong/string_unicode4_negative_test.dart rename to tests/language_2/string_unicode4_negative_test.dart diff --git a/tests/language_strong/substring_test.dart b/tests/language_2/substring_test.dart similarity index 86% rename from tests/language_strong/substring_test.dart rename to tests/language_2/substring_test.dart index 09cde061f70..71c810e2285 100644 --- a/tests/language_strong/substring_test.dart +++ b/tests/language_2/substring_test.dart @@ -7,7 +7,7 @@ import "package:expect/expect.dart"; main() { try { - print("abcdef".substring(1.5, 3.5)); // //# 01: static type warning + print("abcdef".substring(1.5, 3.5)); // //# 01: compile-time error Expect.fail("Should have thrown an exception"); // //# 01: continued } on TypeError catch (e) { // OK. diff --git a/tests/language_strong/super_abstract_method_test.dart b/tests/language_2/super_abstract_method_test.dart similarity index 100% rename from tests/language_strong/super_abstract_method_test.dart rename to tests/language_2/super_abstract_method_test.dart diff --git a/tests/language_strong/super_all_named_constructor_test.dart b/tests/language_2/super_all_named_constructor_test.dart similarity index 100% rename from tests/language_strong/super_all_named_constructor_test.dart rename to tests/language_2/super_all_named_constructor_test.dart diff --git a/tests/language_strong/super_assign_test.dart b/tests/language_2/super_assign_test.dart similarity index 81% rename from tests/language_strong/super_assign_test.dart rename to tests/language_2/super_assign_test.dart index 562c43c4c8e..23a352a1299 100644 --- a/tests/language_strong/super_assign_test.dart +++ b/tests/language_2/super_assign_test.dart @@ -2,8 +2,6 @@ // 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. -import "package:expect/expect.dart"; - class A { int x; } @@ -17,6 +15,5 @@ class C extends A { main() { A a = new C(); a.x = 37; - a.setX(42); - Expect.equals(42, a.x); + a.setX(42); //# 01: compile-time error } diff --git a/tests/language_strong/super_bound_closure_test.dart b/tests/language_2/super_bound_closure_test.dart similarity index 95% rename from tests/language_strong/super_bound_closure_test.dart rename to tests/language_2/super_bound_closure_test.dart index a25ff1ada76..55efcf0b435 100644 --- a/tests/language_strong/super_bound_closure_test.dart +++ b/tests/language_2/super_bound_closure_test.dart @@ -72,15 +72,15 @@ class B extends A { fooIntercept27() => confuse(super.lastWhere)(0); fooIntercept28() => confuse(super.lastWhere)(3, orElse: 77); - bar([var optional]) => -1; // //# 01: static type warning - bar2({ namedOptional }) => -1; // //# 01: continued + bar([var optional]) => -1; // //# 01: compile-time error + bar2({namedOptional}) => -1; // //# 01: continued bar3(x, [var optional]) => -1; // //# 01: continued - bar4(x, { namedOptional }) => -1; //# 01: continued + bar4(x, {namedOptional}) => -1; //# 01: continued gee([var optional]) => -1; // //# 01: continued - gee2({ namedOptional }) => -1; // //# 01: continued + gee2({namedOptional}) => -1; // //# 01: continued gee3(x, [var optional]) => -1; // //# 01: continued - gee4(x, { namedOptional }) => -1; //# 01: continued + gee4(x, {namedOptional}) => -1; //# 01: continued add([var optional = 33]) => -1; trim({namedOptional: 22}) => -1; diff --git a/tests/language_strong/language_strong.status b/tests/language_strong/language_strong.status index b139947dd73..323cf08c7d9 100644 --- a/tests/language_strong/language_strong.status +++ b/tests/language_strong/language_strong.status @@ -398,26 +398,6 @@ setter_override2_test: Skip setter_override_test: Skip source_self_negative_test: Skip static_call_wrong_argument_count_negative_test: Skip -string_interpolation1_negative_test: Skip -string_interpolation2_negative_test: Skip -string_interpolation3_negative_test: Skip -string_interpolation4_negative_test: Skip -string_interpolation5_negative_test: Skip -string_interpolation6_negative_test: Skip -string_interpolation9_test: Skip -string_interpolation_and_buffer_test: Skip -string_interpolation_test: Skip -string_no_operator_test: Skip -string_split_test: Skip -string_supertype_checked_test: Skip -string_test: Skip -string_unicode1_negative_test: Skip -string_unicode2_negative_test: Skip -string_unicode3_negative_test: Skip -string_unicode4_negative_test: Skip -substring_test: Skip -super_assign_test: Skip -super_bound_closure_test: Skip super_call3_test: Skip super_call4_test: Skip super_conditional_operator_test: Skip diff --git a/tests/language_strong/string_no_operator_test.dart b/tests/language_strong/string_no_operator_test.dart deleted file mode 100644 index de69cfaded6..00000000000 --- a/tests/language_strong/string_no_operator_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2015, 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. - -import 'package:expect/expect.dart'; - -main() { - var x = "x"; - var y = "y"; - Expect.throws(() => x < y); - Expect.throws(() => x <= y); - Expect.throws(() => x > y); - Expect.throws(() => x >= y); - Expect.throws(() => x - y); - Expect.throws(() => x * y); - Expect.throws(() => x / y); - Expect.throws(() => x ~/ y); - Expect.throws(() => x % y); - Expect.throws(() => x >> y); - Expect.throws(() => x << y); - Expect.throws(() => x & y); - Expect.throws(() => x | y); - Expect.throws(() => x ^ y); - Expect.throws(() => -x); - Expect.throws(() => ~x); -} diff --git a/tests/language_strong/sub/sub.dart b/tests/language_strong/sub/sub.dart deleted file mode 100644 index 8ad0cde9e60..00000000000 --- a/tests/language_strong/sub/sub.dart +++ /dev/null @@ -1,8 +0,0 @@ -library sub; - -import '../cyclic_import_test.dart'; -import 'package:expect/expect.dart'; - -subMain() { - Expect.equals(42, value); -}