3c973fb292
Change-Id: I228058202855900f0adba73c1ab04d35180a6e5d Tested: this is an analyzer diagnostic only change Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414900 Reviewed-by: Nate Bosch <nbosch@google.com> Commit-Queue: Devon Carew <devoncarew@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com> Reviewed-by: Nate Biggs <natebiggs@google.com> Reviewed-by: Ben Konyi <bkonyi@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';
|
|
|
|
void 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"]));
|
|
});
|
|
}
|