mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:36:59 +00:00
ba10df6611
* Update named configs for unit tests to Dart 2. * Bump json_rpc_2 in front_end package. * Use named configurations in unit tests. * Fix typing issues. Change-Id: Id3b393a0d2abe92c8eaec10fa8057fb35d18a4c6 Reviewed-on: https://dart-review.googlesource.com/67341 Reviewed-by: Jens Johansen <jensj@google.com>
73 lines
2.5 KiB
Dart
73 lines
2.5 KiB
Dart
// Copyright (c) 2018, 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/minitest.dart';
|
|
|
|
import 'package:smith/smith.dart';
|
|
|
|
void main() {
|
|
group("TestMatrix.fromJson()", () {
|
|
test("parses configurations", () {
|
|
var testMatrix = TestMatrix.fromJson({
|
|
"configurations": {
|
|
"x64-dart2js-debug-vm-linux": <String, dynamic>{
|
|
"options": <String, dynamic>{"enable-asserts": true},
|
|
},
|
|
"x64-dartdevc-vm-linux": <String, dynamic>{
|
|
"options": <String, dynamic>{
|
|
"mode": "release",
|
|
"enable-asserts": true
|
|
},
|
|
},
|
|
}
|
|
});
|
|
|
|
expect(
|
|
testMatrix.configurations[0],
|
|
equals(Configuration("x64-dart2js-debug-vm-linux", Architecture.x64,
|
|
Compiler.dart2js, Mode.debug, Runtime.vm, System.linux,
|
|
enableAsserts: true)));
|
|
expect(
|
|
testMatrix.configurations[1],
|
|
equals(Configuration("x64-dartdevc-vm-linux", Architecture.x64,
|
|
Compiler.dartdevc, Mode.release, Runtime.vm, System.linux,
|
|
enableAsserts: true)));
|
|
});
|
|
|
|
test("error if expanded configuration names collide", () {
|
|
expectJsonError(
|
|
'Configuration "none-x64-dart2js-debug-vm-linux" already exists.', {
|
|
"configurations": {
|
|
"none-x64-dart2js-debug-vm-linux": <String, dynamic>{},
|
|
"none-(x64|ia32)-dart2js-debug-vm-linux": <String, dynamic>{},
|
|
}
|
|
});
|
|
});
|
|
|
|
test("error if two configurations have same options", () {
|
|
expectJsonError(
|
|
'Configuration "two-x64-dart2js-debug-vm-linux" is identical to '
|
|
'"one-x64-dart2js-debug-vm-linux".',
|
|
{
|
|
"configurations": {
|
|
"one-x64-dart2js-debug-vm-linux": <String, dynamic>{
|
|
"options": <String, dynamic>{"enable-asserts": true}
|
|
},
|
|
"two-x64-dart2js-debug-vm-linux": <String, dynamic>{
|
|
"options": <String, dynamic>{"enable-asserts": true}
|
|
},
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
void expectJsonError(String error, Map<String, dynamic> json) {
|
|
try {
|
|
var testMatrix = TestMatrix.fromJson(json);
|
|
fail("Expected FormatException but got $testMatrix.");
|
|
} on FormatException catch (ex) {
|
|
expect(ex.message, equals(error));
|
|
}
|
|
}
|