Files
sdk/tests/language_strong/constructor7_test.dart
T
Bob Nystrom 6c757957db Move the dev_compiler strong mode tests into sdk/tests/.
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.
2016-12-09 11:09:55 -08:00

65 lines
1.4 KiB
Dart

// 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.
// Dart test program for constructors and initializers.
import "package:expect/expect.dart";
// Expect the initializer expressions E(i) to be evaluated
// in the order 1, 2, 3, ...
// This test has no inheritance but many fields to flush out issues with
// ordering of fields.
String trace = "";
int E(int i) {
trace += "$i-";
return i;
}
class A {
var j; // Names are in reverse order to detect sorting by name...
var i = 0; // Initialized odd/even to detect these inits affecting order.
var h;
var g = 0;
var f;
var e = 0;
var d;
var c = 0;
var b;
var a = 0;
A()
: a = E(1), // Initializations in different order to decls. Ascending...
b = E(2),
c = E(3),
f = E(4), // Descending to be perverse...
e = E(5),
d = E(6),
g = E(7), // Ascending again.
h = E(8),
i = E(9),
j = E(10) {
Expect.equals(1, a);
Expect.equals(2, b);
Expect.equals(3, c);
Expect.equals(4, f);
Expect.equals(5, e);
Expect.equals(6, d);
Expect.equals(7, g);
Expect.equals(8, h);
Expect.equals(9, i);
Expect.equals(10, j);
}
}
main() {
var x = new A();
Expect.equals('1-2-3-4-5-6-7-8-9-10-', trace);
}