edadc9c881
This is important as we will soon add support for compiling the sdk as a module and we would like to only compile it once when running a suite of tests. + also enable caching in the dart2js pipeline test. Change-Id: Ic9043f868123164f3ab425ba73f7428416b05fc0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103485 Commit-Queue: Sigmund Cherem <sigmund@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
77 lines
2.1 KiB
Dart
77 lines
2.1 KiB
Dart
// Copyright (c) 2019, 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:test/test.dart';
|
|
import 'package:modular_test/src/test_specification_parser.dart';
|
|
|
|
main() {
|
|
test('require dependencies section', () {
|
|
expect(() => parseTestSpecification(""),
|
|
throwsA(TypeMatcher<InvalidSpecificationError>()));
|
|
});
|
|
|
|
test('dependencies is a map', () {
|
|
expect(() => parseTestSpecification("dependencies: []"),
|
|
throwsA(TypeMatcher<InvalidSpecificationError>()));
|
|
});
|
|
|
|
test('dependencies can be a string or list of strings', () {
|
|
parseTestSpecification('''
|
|
dependencies:
|
|
a: b
|
|
''');
|
|
|
|
parseTestSpecification('''
|
|
dependencies:
|
|
a: [b, c]
|
|
''');
|
|
|
|
expect(() => parseTestSpecification('''
|
|
dependencies:
|
|
a: 1
|
|
'''), throwsA(TypeMatcher<InvalidSpecificationError>()));
|
|
|
|
expect(() => parseTestSpecification('''
|
|
dependencies:
|
|
a: true
|
|
'''), throwsA(TypeMatcher<InvalidSpecificationError>()));
|
|
|
|
expect(() => parseTestSpecification('''
|
|
dependencies:
|
|
a: [false]
|
|
'''), throwsA(TypeMatcher<InvalidSpecificationError>()));
|
|
|
|
expect(() => parseTestSpecification('''
|
|
dependencies:
|
|
a:
|
|
c: d
|
|
'''), throwsA(TypeMatcher<InvalidSpecificationError>()));
|
|
});
|
|
|
|
test('result map is normalized', () {
|
|
expect(
|
|
parseTestSpecification('''
|
|
dependencies:
|
|
a: [b, c]
|
|
b: d
|
|
''').dependencies,
|
|
equals({
|
|
'a': ['b', 'c'],
|
|
'b': ['d'],
|
|
}));
|
|
});
|
|
|
|
test('flags are normalized', () {
|
|
expect(parseTestSpecification('''
|
|
dependencies: {}
|
|
flags: "a"
|
|
''').flags, equals(["a"]));
|
|
|
|
expect(parseTestSpecification('''
|
|
dependencies: {}
|
|
flags: ["a"]
|
|
''').flags, equals(["a"]));
|
|
});
|
|
}
|