Skip to content

Commit

Permalink
Publish 0.1.26.
Browse files Browse the repository at this point in the history
* Updated tests to use package `test` (#302).

Fixes: #302

BUG=
R=alexeidiaz@google.com

Review URL: https://codereview.chromium.org//2310833003 .
  • Loading branch information
pq committed Sep 5, 2016
1 parent 1f9f408 commit a564865
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 107 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.1.26

* Updated tests to use package `test` (#302).

# 0.1.25

* Fixed false positive on `[]=` in `always_declare_return_types` (#300).
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: linter
version: 0.1.25
version: 0.1.26
author: Dart Team <misc@dartlang.org>
description: Style linter for Dart.
homepage: https://github.com/dart-lang/linter
Expand All @@ -18,4 +18,4 @@ dev_dependencies:
markdown: ^0.11.0
matcher: ^0.12.0
mockito: ^1.0.0
unittest: ^0.11.0
test: ^0.12.0
73 changes: 0 additions & 73 deletions test/all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:linter/src/io.dart';
import 'package:unittest/unittest.dart';

import 'config_test.dart' as config_test;
import 'engine_test.dart' as engine_test;
Expand All @@ -17,12 +16,8 @@ import 'pub_test.dart' as pub_test;
import 'rule_test.dart' as rule_test;

main() {
// Tidy up the unittest output.
filterStacks = true;
formatStacks = true;

// useCompactVMConfiguration();
//useTimingConfig();

// Redirect output.
outSink = new MockIOSink();
Expand All @@ -37,71 +32,3 @@ main() {
pub_test.main();
rule_test.main();
}

void useTimingConfig() {
unittestConfiguration = new TimingTestConfig();
}

class TimingTestConfig extends SimpleConfiguration {
/// Tests that are this fast (in seconds) are uninteresting.
static const threshold = 0;

/// Clocks total elapsed time.
final bigWatch = new Stopwatch();

/// Clocks individual tests.
final testWatch = new Stopwatch();

/// Maps tests to times.
final watches = <TestCase, double>{};

@override
String formatResult(TestCase testCase) {
var result = new StringBuffer();
result.write(testCase.result.toUpperCase());
result.write(": ");
result.write(testCase.description);
var elapsed = watches[testCase];
if (elapsed > threshold) {
result.write(' [$elapsed]');
}
result.write("\n");

if (testCase.message != '') {
result.write(indent(testCase.message));
result.write("\n");
}

if (testCase.stackTrace != null) {
result.write(indent(testCase.stackTrace.toString()));
result.write("\n");
}
return result.toString();
}

String indent(String str) =>
str.replaceAll(new RegExp("^", multiLine: true), " ");

@override
void onDone(bool success) {
bigWatch.stop();
super.onDone(success);
print('Total time = ${bigWatch.elapsedMilliseconds / 1000} seconds.');
}

@override
void onStart() => bigWatch.start();

@override
void onTestResult(TestCase externalTestCase) {
watches[externalTestCase] = testWatch.elapsedMilliseconds / 1000;
super.onTestResult(externalTestCase);
}

@override
void onTestStart(TestCase testCase) {
testWatch.reset();
testWatch.start();
super.onTestStart(testCase);
}
}
4 changes: 1 addition & 3 deletions test/config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
library linter.test.config;

import 'package:linter/src/config.dart';
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';

main() {
groupSep = ' | ';

defineTests();
}

Expand Down
10 changes: 1 addition & 9 deletions test/engine_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ import 'package:linter/src/io.dart';
import 'package:linter/src/linter.dart';
import 'package:linter/src/pub.dart';
import 'package:mockito/mockito.dart';
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';

import '../bin/linter.dart' as dartlint;
import 'mocks.dart';
import 'rule_test.dart' show ruleDir;

main() {
groupSep = ' | ';

defineLinterEngineTests();
}

Expand Down Expand Up @@ -170,12 +168,6 @@ void defineLinterEngineTests() {
dartlint.main(['-XXXXX']);
expect(exitCode, equals(dartlint.unableToProcessExitCode));
});
//TODO: revisit error handling
skip_test('bad path', () {
var badPath = new Directory(ruleDir).path + '/___NonExistent.dart';
dartlint.main([badPath]);
expect(exitCode, equals(dartlint.unableToProcessExitCode));
});
test('custom sdk path', () {
// Smoke test to ensure a custom sdk path doesn't sink the ship
FileSystemEntity firstRuleTest =
Expand Down
4 changes: 1 addition & 3 deletions test/formatter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import 'package:analyzer/src/generated/error.dart';
import 'package:linter/src/formatter.dart';
import 'package:linter/src/linter.dart';
import 'package:mockito/mockito.dart';
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';

import 'mocks.dart';

main() {
groupSep = ' | ';

defineTests();
}

Expand Down
4 changes: 1 addition & 3 deletions test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import 'package:linter/src/config.dart';
import 'package:linter/src/io.dart';
import 'package:linter/src/linter.dart';
import 'package:mockito/mockito.dart';
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';

import '../bin/linter.dart' as dartlint;
import 'mocks.dart';

main() {
groupSep = ' | ';

defineTests();
}

Expand Down
4 changes: 1 addition & 3 deletions test/io_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ library linter.test.io;
import 'package:linter/src/io.dart';
import 'package:mockito/mockito.dart';
import 'package:path/path.dart' as p;
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';

import 'mocks.dart';

main() {
groupSep = ' | ';

defineTests();
}

Expand Down
3 changes: 1 addition & 2 deletions test/plugin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import 'package:analyzer/src/services/lint.dart';
import 'package:linter/src/plugin/linter_plugin.dart';
import 'package:plugin/manager.dart';
import 'package:plugin/plugin.dart';
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';
import 'package:yaml/yaml.dart';

main() {
groupSep = ' | ';

defineTests();
}
Expand Down
4 changes: 1 addition & 3 deletions test/project_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ library linter.test.project;
import 'dart:io';

import 'package:linter/src/project.dart';
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';

main() {
groupSep = ' | ';

defineTests();
}

Expand Down
4 changes: 1 addition & 3 deletions test/pub_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ import 'package:linter/src/pub.dart';
import 'package:mockito/mockito.dart';
import 'package:path/path.dart' as p;
import 'package:source_span/source_span.dart';
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';

import 'mocks.dart';

main() {
groupSep = ' | ';

defineTests();
}

Expand Down
4 changes: 1 addition & 3 deletions test/rule_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ import 'package:linter/src/rules/implementation_imports.dart';
import 'package:linter/src/rules/package_prefixed_library_names.dart';
import 'package:linter/src/util.dart';
import 'package:path/path.dart' as p;
import 'package:unittest/unittest.dart';
import 'package:test/test.dart';

main() {
groupSep = ' | ';

defineSanityTests();
defineRuleTests();
defineRuleUnitTests();
Expand Down

0 comments on commit a564865

Please sign in to comment.