move version test to a proper test
diff --git a/pkgs/markdown/test/version_test.dart b/pkgs/markdown/test/version_test.dart new file mode 100644 index 0000000..36fcfd3 --- /dev/null +++ b/pkgs/markdown/test/version_test.dart
@@ -0,0 +1,30 @@ +import 'dart:io'; +import 'dart:mirrors'; + +import 'package:path/path.dart' as p; +import 'package:test/test.dart'; +import 'package:yaml/yaml.dart'; + +// Locate the "tool" directory. Use mirrors so that this works with the test +// package, which loads this suite into an isolate. +String get _currentDir => p + .dirname((reflect(main) as ClosureMirror).function.location.sourceUri.path); + +void main() { + test('check versions', () { + var binary = p.normalize(p.join(_currentDir, '..', 'bin/markdown.dart')); + var result = Process.runSync('dart', [binary, '--version']); + expect(result.exitCode, 0); + + var binVersion = (result.stdout as String).trim(); + + var pubspecFile = p.normalize(p.join(_currentDir, '..', 'pubspec.yaml')); + + var pubspecContent = + loadYaml(new File(pubspecFile).readAsStringSync()) as YamlMap; + + expect(binVersion, pubspecContent['version'], + reason: 'The version reported by bin/markdown.dart ' + 'should match the version in pubspec.'); + }); +}
diff --git a/pkgs/markdown/tool/travis.sh b/pkgs/markdown/tool/travis.sh index 1d55ade..924c102 100755 --- a/pkgs/markdown/tool/travis.sh +++ b/pkgs/markdown/tool/travis.sh
@@ -20,15 +20,3 @@ else echo All Dart source files are formatted. fi - -# Assert that versions match. -pubspec_version=$(awk '/^version:/' pubspec.yaml |cut -f2 -d' ') -bin_version=$(dart bin/markdown.dart --version ) -if [[ $pubspec_version != $bin_version ]]; then - echo Version mismatch: - echo " From pubspec.yaml: $pubspec_version" - echo " From lib/src/version.dart: $bin_version" - exit 1 -else - echo Package versions match. -fi