6c757957db
DDC's codegen test copies those files to a local "gen" directory so that it can do stuff like splitting out the multitests before it compiles them to JS. I left all of that alone, so the rest of DDC's test infrastructure is unchanged. The very first step that builds the "gen" directory just copies from sdk/tests/..._strong/... instead and the rest is good to go. I did not move not_yet_strong_tests.dart somewhere more accessible yet because I'm not sure if kernel needs it or where it should go. I did not create any status files because DDC doesn't need them and there are no test suites for the new directories for the other platforms.
68 lines
2.0 KiB
Dart
68 lines
2.0 KiB
Dart
// 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.
|
|
// Test that instanceof works correctly with type variables.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
// Test that partially typed generic instances are correctly constructed.
|
|
|
|
// Test factory case.
|
|
class Foo<K, V> {
|
|
Foo() { }
|
|
|
|
factory Foo.fac() {
|
|
return new Foo<K, V>();
|
|
}
|
|
|
|
FooString() {
|
|
return new Foo<K, String>.fac();
|
|
}
|
|
}
|
|
|
|
// Test constructor case.
|
|
class Moo<K, V> {
|
|
Moo() { }
|
|
|
|
MooString() {
|
|
return new Moo<K, String>();
|
|
}
|
|
}
|
|
|
|
testAll () {
|
|
var foo_int_num = new Foo<int, num>();
|
|
Expect.isTrue(foo_int_num is Foo<int, num>);
|
|
Expect.isTrue(foo_int_num is !Foo<int, String>);
|
|
// foo_int_num.FooString() returns a Foo<int, String>
|
|
Expect.isTrue(foo_int_num.FooString() is !Foo<int, num>);
|
|
Expect.isTrue(foo_int_num.FooString() is Foo<int, String>);
|
|
|
|
var foo_raw = new Foo();
|
|
Expect.isTrue(foo_raw is Foo<int, num>);
|
|
Expect.isTrue(foo_raw is Foo<int, String>);
|
|
// foo_raw.FooString() returns a Foo<dynamic, String>
|
|
Expect.isTrue(foo_raw.FooString() is !Foo<int, num>);
|
|
Expect.isTrue(foo_raw.FooString() is Foo<int, String>);
|
|
|
|
var moo_int_num = new Moo<int, num>();
|
|
Expect.isTrue(moo_int_num is Moo<int, num>);
|
|
Expect.isTrue(moo_int_num is !Moo<int, String>);
|
|
// moo_int_num.MooString() returns a Moo<int, String>
|
|
Expect.isTrue(moo_int_num.MooString() is !Moo<int, num>);
|
|
Expect.isTrue(moo_int_num.MooString() is Moo<int, String>);
|
|
|
|
var moo_raw = new Moo();
|
|
Expect.isTrue(moo_raw is Moo<int, num>);
|
|
Expect.isTrue(moo_raw is Moo<int, String>);
|
|
// moo_raw.MooString() returns a Moo<dynamic, String>
|
|
Expect.isTrue(moo_raw.MooString() is !Moo<int, num>);
|
|
Expect.isTrue(moo_raw.MooString() is Moo<int, String>);
|
|
}
|
|
|
|
|
|
main() {
|
|
// Repeat type checks so that inlined tests can be tested as well.
|
|
for (int i = 0; i < 5; i++) {
|
|
testAll();
|
|
}
|
|
} |