Collect all test-related files in package:expect.

Collects files from `package:async_helper` and `tests/language`
that are generally useful, so that all test-related helpers are
in `package:expect`.

Moves the two libraries from `package:async_helper` into `package:expect`,
and the `tests/language/static_type_helper.dart` file too.

Deprecates `async_minitest.dart`, to follow `minitest.dart`,
expecting the Flutter use of it to have been fixed to not break
on deprecation (I believe Flutter no longer breaks builds on deprecations at all).

Patch 1 is the actual change.
Patch 2+4+8 is changing all existing references to the files.
Patch 6 ignores deprecation in files still using `async_minitest.dart`.

3+5+7+9 are updating this text to make the numbers match.
Then it's just test-expectations and small tweaks from there.

Change-Id: I1b665135b5fef9b9a0c3b340ffe9daf874d0174c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373120
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
This commit is contained in:
Lasse R.H. Nielsen
2024-10-11 16:53:52 +00:00
committed by Commit Queue
parent b68b86b56b
commit f8086c81ae
1302 changed files with 2339 additions and 2343 deletions
+3 -3
View File
@@ -495,12 +495,12 @@ some failed way that the test runner can detect and determine that a runtime
error occurred.
If you are writing asynchronous tests, there is a separate tiny
["async_helper"][async pkg] package that talks to the test runner to ensure all
["async_helper"][async helper] library that talks to the test runner to ensure all
asynchronous operations performed by the test have a chance to complete.
[async pkg]: https://github.com/dart-lang/sdk/tree/main/pkg/async_helper
[async helper]: https://github.com/dart-lang/sdk/tree/main/pkg/expect/lib/async_helper.dart
With these two packages, it's straightforward to write tests of expected correct
With these two libraries, it's straightforward to write tests of expected correct
runtime behavior. You can also write tests for validating runtime *failures* by
using the helper functions for checking that certain exceptions are thrown:
+3 -151
View File
@@ -2,156 +2,8 @@
// 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.
/// This library is used for testing asynchronous tests.
/// If a test is asynchronous, it needs to notify the testing driver
/// about this (otherwise tests may get reported as passing after main()
/// finished even if the asynchronous operations fail).
///
/// This library provides four methods
/// - asyncStart(): Needs to be called before an asynchronous operation is
/// scheduled.
/// - asyncEnd(): Needs to be called as soon as the asynchronous operation
/// ended.
/// - asyncSuccess(_): Variant of asyncEnd useful together with Future.then.
/// - asyncTest(f()): Helper method that wraps a computation that returns a
/// Future with matching calls to asyncStart() and
/// asyncSuccess(_).
/// After every asyncStart() called is matched with a corresponding
/// asyncEnd() or asyncSuccess(_) call, the testing driver will be notified that
/// the tests is done.
// Will be deprecated or removed when possible
// TODO: @Deprecated('Use this library directly from package:expect instead')
library;
import 'dart:async';
import 'package:expect/expect.dart';
bool _initialized = false;
int _asyncLevel = 0;
Exception _buildException(String msg) {
return Exception('Fatal: $msg. This is most likely a bug in your test.');
}
/// Call this method before an asynchronous test is created.
///
/// If [count] is provided, expect [count] [asyncEnd] calls instead of just one.
void asyncStart([int count = 1]) {
if (count <= 0) return;
if (_initialized && _asyncLevel == 0) {
throw _buildException('asyncStart() was called even though we are done '
'with testing.');
}
if (!_initialized) {
print('unittest-suite-wait-for-done');
_initialized = true;
}
_asyncLevel += count;
}
/// Call this after an asynchronous test has ended successfully.
void asyncEnd() {
if (_asyncLevel <= 0) {
if (!_initialized) {
throw _buildException('asyncEnd() was called before asyncStart().');
} else {
throw _buildException('asyncEnd() was called more often than '
'asyncStart().');
}
}
_asyncLevel--;
if (_asyncLevel == 0) {
print('unittest-suite-success');
}
}
/// Call this after an asynchronous test has ended successfully. This is a helper
/// for calling [asyncEnd].
///
/// This method intentionally has a signature that matches `Future.then` as a
/// convenience for calling [asyncEnd] when a `Future` completes without error,
/// like this:
/// ```dart
/// asyncStart();
/// Future result = test();
/// result.then(asyncSuccess);
/// ```
void asyncSuccess(void _) {
asyncEnd();
}
/// Helper method for performing asynchronous tests involving `Future`.
///
/// The function [test] must return a `Future` which completes without error
/// when the test is successful.
Future<void> asyncTest(Function() test) {
asyncStart();
return test().then(asyncSuccess);
}
/// Verifies that the asynchronous [result] throws a [T].
///
/// Fails if [result] completes with a value, or it completes with
/// an error which is not a [T].
///
/// Returns the accepted thrown object.
/// For example, to check the content of the thrown object,
/// you could write this:
/// ```
/// var e = await asyncExpectThrows<MyException>(asyncExpression)
/// Expect.isTrue(e.myMessage.contains("WARNING"));
/// ```
/// If `result` completes with an [ExpectException] error from another
/// failed test expectation, that error cannot be caught and accepted.
Future<T> asyncExpectThrows<T extends Object>(Future<void> result,
[String reason = ""]) {
// Delay computing the header text until the test has failed.
// The header computation uses complicated language features,
// and language tests should avoid doing complicated things
// until after the actual test has had a chance to succeed.
String header() {
// Handle null being passed in from legacy code
// while also avoiding producing an unnecessary null check warning here.
if ((reason as dynamic) == null) reason = "";
// Only include the type in the message if it's not `Object`.
var type = Object() is! T ? "<$T>" : "";
return "asyncExpectThrows$type($reason):";
}
// Unsound null-safety check.
if ((result as dynamic) == null) {
Expect.testError("${header()} result Future must not be null.");
}
// TODO(rnystrom): It might useful to validate that T is not bound to
// ExpectException since that won't work.
asyncStart();
return result.then<T>((_) {
throw ExpectException("${header()} Did not throw.");
}, onError: (error, stack) {
// A test failure doesn't count as throwing. Rethrow it.
if (error is ExpectException) throw error;
if (error is! T) {
// Throws something unexpected.
throw ExpectException(
"${header()} Unexpected '${Error.safeToString(error)}'\n$stack");
}
asyncEnd();
return error;
});
}
/// Checks that the asynchronous [result] throws a [T] if and only if
/// [condition] is `true`.
///
/// When [condition] is `false`, [result] is expected to complete without
/// errors.
Future<T?> asyncExpectThrowsWhen<T extends Object>(
bool condition, Future<void> result,
[String reason = ""]) {
return condition
? asyncExpectThrows<T>(result, reason)
: result.then<T?>((_) => null);
}
export 'package:expect/async_helper.dart';
+2 -332
View File
@@ -2,337 +2,7 @@
// 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.
/// A minimal, dependency-free emulation layer for a subset of the
/// unittest/test API used by the language and core library.
///
/// Compared with `minitest.dart`, this library supports and expects
/// asynchronous tests. It uses a `Zone` per test to associate a test name with
/// the failure.
///
/// It does not support `setUp` or `tearDown` methods,
/// and matchers are severely restricted.
///
/// A number of our language and core library tests were written against the
/// unittest package, which is now deprecated in favor of the new test package.
/// The latter is much better feature-wise, but is also quite complex and has
/// many dependencies. For low-level language and core library tests, we don't
/// want to have to pull in a large number of dependencies and be able to run
/// them correctly in order to run a test, so we want to test them against
/// something simpler.
///
/// When possible, we just use the tiny expect library. But to avoid rewriting
/// all of the existing tests that use unittest, they can instead use this,
/// which shims the unittest API with as little code as possible and calls into
/// expect.
///
/// Eventually, it would be good to refactor those tests to use the expect
/// package directly and remove this.
@Deprecated('Use expect.dart and async_helper.dart directly')
library;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
void group(String name, Function() body) {
var oldName = _pushName(name);
try {
body();
} finally {
_popName(oldName);
}
}
void test(String name, Function() body) {
var oldName = _pushName(name);
asyncStart();
var result = runZoned(body, zoneValues: {_testToken: _currentName});
if (result is Future) {
result.then((_) {
asyncEnd();
});
} else {
// Ensure all tests get to be set up first.
scheduleMicrotask(asyncEnd);
}
_popName(oldName);
}
void expect(dynamic value, dynamic matcher, {String reason = ""}) {
Matcher m;
if (matcher is _Matcher) {
m = matcher.call;
} else if (matcher is! Matcher) {
m = equals(matcher);
} else {
m = matcher;
}
m(value);
}
R Function() expectAsync0<R>(R Function() f, {int count = 1}) {
asyncStart(count);
return () {
var result = f();
asyncEnd();
return result;
};
}
R Function(A) expectAsync1<R, A>(R Function(A) f, {int count = 1}) {
asyncStart(count);
return (A a) {
var result = f(a);
asyncEnd();
return result;
};
}
R Function(A, B) expectAsync2<R, A, B>(R Function(A, B) f, {int count = 1}) {
asyncStart(count);
return (A a, B b) {
var result = f(a, b);
asyncEnd();
return result;
};
}
dynamic expectAsync(Function f, {int count = 1}) {
var f2 = f; // Avoid type-promoting f, we want dynamic invocations.
if (f2 is Function(Never, Never, Never, Never, Never)) {
asyncStart(count);
return ([a, b, c, d, e]) {
var result = f(a, b, c, d, e);
asyncEnd();
return result;
};
}
if (f2 is Function(Never, Never, Never, Never)) {
asyncStart(count);
return ([a, b, c, d]) {
var result = f(a, b, c, d);
asyncEnd();
return result;
};
}
if (f2 is Function(Never, Never, Never)) {
asyncStart(count);
return ([a, b, c]) {
var result = f(a, b, c);
asyncEnd();
return result;
};
}
if (f2 is Function(Never, Never)) {
asyncStart(count);
return ([a, b]) {
var result = f(a, b);
asyncEnd();
return result;
};
}
if (f2 is Function(Never)) {
asyncStart(count);
return ([a]) {
var result = f(a);
asyncEnd();
return result;
};
}
if (f2 is Function()) {
asyncStart(count);
return () {
var result = f();
asyncEnd();
return result;
};
}
throw UnsupportedError(
"expectAsync only accepts up to five argument functions");
}
// Matchers
typedef Matcher = void Function(dynamic);
Matcher same(dynamic o) => (v) {
Expect.identical(o, v);
};
Matcher equals(dynamic o) => (v) {
Expect.deepEquals(o, v);
};
Matcher greaterThan(num n) => (dynamic v) {
Expect.type<num>(v);
num value = v;
if (value > n) return;
Expect.fail("$v is not greater than $n");
};
Matcher greaterThanOrEqualTo(num n) => (dynamic v) {
Expect.type<num>(v);
num value = v;
if (value >= n) return;
Expect.fail("$v is not greater than $n");
};
Matcher lessThan(num n) => (dynamic v) {
Expect.type<num>(v);
num value = v;
if (value < n) return;
Expect.fail("$v is not less than $n");
};
Matcher lessThanOrEqualTo(num n) => (dynamic v) {
Expect.type<num>(v);
num value = v;
if (value <= n) return;
Expect.fail("$v is not less than $n");
};
Matcher predicate(bool Function(dynamic value) fn, [String description = ""]) =>
(dynamic v) {
Expect.isTrue(fn(v), description);
};
Matcher anyOf(List<String> expected) => (dynamic actual) {
for (var string in expected) {
if (actual == string) return;
}
Expect.fail("Expected $actual to be one of $expected.");
};
void isTrue(dynamic v) {
Expect.isTrue(v);
}
void isFalse(dynamic v) {
Expect.isFalse(v);
}
void isNull(dynamic o) {
Expect.isNull(o);
}
void _checkThrow<T extends Object>(
dynamic v, void Function(dynamic error) onError) {
if (v is Future) {
asyncStart();
v.then((_) {
Expect.fail("Did not throw");
}, onError: (e, s) {
if (e is! T) throw e;
onError(e);
asyncEnd();
});
return;
}
Expect.throws<T>(v, (e) {
onError(e);
return true;
});
}
void returnsNormally(dynamic o) {
try {
Expect.type<Function()>(o);
o();
} catch (error, trace) {
Expect.fail(
"Expected function to return normally, but threw:\n$error\n\n$trace");
}
}
void throws(dynamic v) {
_checkThrow<Object>(v, (_) {});
}
Matcher throwsA(matcher) => (dynamic o) {
_checkThrow<Object>(o, (error) {
expect(error, matcher);
});
};
Matcher completion(matcher) => (dynamic o) {
Expect.type<Future>(o);
Future future = o;
asyncStart();
future.then((value) {
expect(value, matcher);
asyncEnd();
});
};
void completes(dynamic o) {
Expect.type<Future>(o);
Future future = o;
asyncStart();
future.then(asyncSuccess);
}
void isMap(dynamic o) {
Expect.type<Map>(o);
}
void isList(dynamic o) {
Expect.type<List>(o);
}
void isNotNull(dynamic o) {
Expect.isNotNull(o);
}
abstract class _Matcher {
void call(dynamic o);
}
// ignore: camel_case_types
class isInstanceOf<T> implements _Matcher {
@override
void call(dynamic o) {
Expect.type<T>(o);
}
}
void throwsArgumentError(dynamic v) {
_checkThrow<ArgumentError>(v, (_) {});
}
void throwsStateError(dynamic v) {
_checkThrow<StateError>(v, (_) {});
}
void fail(String message) {
Expect.fail(message);
}
/// Key for zone value holding current test name.
final _testToken = Object();
bool _initializedTestNameCallback = false;
/// The current combined name of the nesting [group] or [test].
String _currentName = "";
String _pushName(String newName) {
// Look up the current test name from the zone created for the test.
if (!_initializedTestNameCallback) {
ExpectException.setTestNameCallback(() => Zone.current[_testToken]);
_initializedTestNameCallback = true;
}
var oldName = _currentName;
if (oldName == "") {
_currentName = newName;
} else {
_currentName = "$oldName $newName";
}
return oldName;
}
void _popName(String oldName) {
_currentName = oldName;
}
export 'package:expect/legacy/async_minitest.dart';
-1
View File
@@ -30,7 +30,6 @@ dev_dependencies:
js: any
path: any
source_maps: any
async_helper: any
dart2js_tools: any
expect: any
modular_test: any
@@ -7,12 +7,12 @@ import 'dart:convert' as json;
import 'dart:io';
import 'package:args/args.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/ir/util.dart';
import 'package:compiler/src/util/memory_compiler.dart';
import 'package:compiler/src/phase/load_kernel.dart' as load_kernel;
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:front_end/src/api_unstable/dart2js.dart' show relativizeUri;
import 'package:kernel/ast.dart' as ir;
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'analysis_helper.dart';
// TODO(johnniwinther): Remove unneeded dynamic accesses from platform source
@@ -4,7 +4,7 @@
import 'dart:io';
import 'package:_fe_analyzer_shared/src/testing/features.dart';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
+1 -1
View File
@@ -5,7 +5,6 @@
import 'dart:io' hide Link;
import 'package:_fe_analyzer_shared/src/testing/features.dart';
import 'package:_fe_analyzer_shared/src/util/link.dart' show Link;
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
@@ -13,6 +12,7 @@ import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_model/element_map.dart';
import 'package:compiler/src/js_model/js_world.dart';
import 'package:compiler/src/js_model/locals.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:kernel/ast.dart' as ir;
import '../equivalence/id_equivalence.dart';
@@ -4,7 +4,7 @@
// Test constant folding on numbers.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String INT_PLUS_ZERO = """
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
+1 -1
View File
@@ -5,7 +5,7 @@
library bitops1_test;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const COMMON = r"""
+1 -1
View File
@@ -5,7 +5,7 @@
library bitops2_test;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const COMMON = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -5,8 +5,8 @@
// Test that parameters keep their names in the output.
import 'dart:async';
import "package:expect/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -4,8 +4,8 @@
// Test that parameters keep their names in the output.
import "package:expect/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -4,8 +4,8 @@
// Test that parameters keep their names in the output.
import "package:expect/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST1 = r"""
@@ -5,8 +5,8 @@
// Test that parameters keep their names in the output.
import 'dart:async';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_INVOCATION0 = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
@@ -4,7 +4,7 @@
// Test constant folding on numbers.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_1 = """
@@ -4,8 +4,8 @@
// Test constant folding on numbers.
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String NUMBER_FOLDING = """
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import '../helpers/compiler_helper.dart';
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
String TEST = r'''
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -4,7 +4,7 @@
// Test that parameters keep their names in the output.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import '../helpers/compiler_helper.dart';
@@ -6,7 +6,7 @@
// optimization is done by the simplifier, so inlining does not need to be
// enabled.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import '../helpers/compiler_helper.dart';
@@ -4,8 +4,8 @@
// Test that unused static consts are not emitted.
import "package:expect/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST_GUIDE = r"""
+1 -1
View File
@@ -5,7 +5,7 @@
library equals_test;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST1 = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/util/memory_compiler.dart';
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/elements/entities.dart';
@@ -4,8 +4,8 @@
// Test that parameters keep their names in the output.
import "package:expect/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST_NULL0 = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
// Test for emitting JavaScript pre- and post-increment and assignment ops.
+1 -1
View File
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
String SHOULD_NOT_BE_BOXED_TEST = r'''
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String FIB = r"""
@@ -7,8 +7,8 @@
// unused. This resulted in `null` being added to a list that wouldn't otherwise
// need to support null.
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST = r"""
+1 -1
View File
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
+1 -1
View File
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import '../helpers/compiler_helper.dart';
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String MAIN = r"""
@@ -5,11 +5,11 @@
/// Test that checks that we are not added $isFunction properties on closure
/// classes.
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/js_emitter/model.dart';
import 'package:compiler/src/js_model/js_strategy.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/util/memory_compiler.dart';
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_IF_BOOL_FIRST_INSTRUCTION = r"""
@@ -3,8 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_IF = r"""
@@ -5,7 +5,6 @@
// Test that `length` access in JSArray.indexOf is encoding using `.length` and
// not `.get$length()`.
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/elements/entities.dart';
@@ -15,6 +14,7 @@ import 'package:compiler/src/js_emitter/model.dart';
import 'package:compiler/src/js_model/js_strategy.dart';
import 'package:compiler/src/js/js.dart' as js;
import 'package:compiler/src/universe/selector.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/util/memory_compiler.dart';
import '../helpers/element_lookup.dart';
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import '../helpers/compiler_helper.dart';
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_DIRECT = r"""
+1 -1
View File
@@ -5,7 +5,7 @@
// Check that we hoist instructions in a loop condition, even if that
// condition involves control flow.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST = '''
@@ -4,8 +4,8 @@
/// TODO(johnniwinther): Currently this only works with the mock compiler.
import "package:expect/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST1 = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST1 = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST = """
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST_1 = """
+1 -1
View File
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -4,7 +4,7 @@
// Test that parameters keep their names in the output.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import '../helpers/compiler_helper.dart';
+1 -1
View File
@@ -4,7 +4,7 @@
import 'dart:io';
import 'package:_fe_analyzer_shared/src/testing/features.dart';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common/codegen.dart';
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String MOD1 = r"""
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
// A bug in UnaryNegateSpecializer left '-a' labelled as 'positive', allowing
@@ -5,7 +5,7 @@
library new_rti_is_test;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
// 'N' tests all have a nullable input so should not reduce is-test.
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST = r"""
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import '../helpers/compiler_helper.dart';
import "package:async_helper/async_helper.dart";
import "package:expect/async_helper.dart";
const String CODE = """
var x = 0;
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart";
import "package:expect/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String CODE = """
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart";
import "package:expect/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST = r"""
@@ -4,7 +4,7 @@
import "package:expect/expect.dart";
import '../helpers/compiler_helper.dart';
import "package:async_helper/async_helper.dart";
import "package:expect/async_helper.dart";
const String TEST1 = r"""
main() {
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -6,7 +6,7 @@ import 'dart:async';
import 'package:expect/expect.dart';
import 'package:compiler/compiler_api.dart' as api;
import 'package:compiler/src/commandline_options.dart';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:compiler/src/util/memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
@@ -6,7 +6,7 @@
// VMOptions=--enable_asserts
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String SOURCE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_model/js_world.dart' show JClosedWorld;
@@ -4,8 +4,8 @@
// Test that parameters keep their names in the output.
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String FOO = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -4,8 +4,8 @@
// Regression test for http://dartbug.com/10231.
import "package:expect/async_helper.dart";
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String SOURCE = """
@@ -5,7 +5,7 @@
library shru_test;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const COMMON = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
@@ -4,7 +4,7 @@
/// TODO(johnniwinther): Port this test to use the equivalence framework.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import '../helpers/compiler_helper.dart';
@@ -4,7 +4,7 @@
// Test that parameters keep their names in the output.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -4,8 +4,8 @@
// Test that static functions are closurized as expected.
import "package:expect/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
main() {
@@ -4,7 +4,7 @@
// Test constant folding on numbers.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String CODE = """
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
main() {
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import '../helpers/compiler_helper.dart';
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
main() {
@@ -4,7 +4,7 @@
// Test constant folding on numbers.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String SIMPLY_EMPTY = """
+1 -1
View File
@@ -5,7 +5,7 @@
library tdiv_test;
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST1 = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'package:compiler/src/util/memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
@@ -4,8 +4,8 @@
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/elements/names.dart';
import "package:expect/async_helper.dart";
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/inferrer/typemasks/masks.dart';
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,7 +2,7 @@
// 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:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -2,8 +2,8 @@
// 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/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import '../helpers/compiler_helper.dart';
const String TEST_ONE = r"""
@@ -4,7 +4,6 @@
/// TODO(johnniwinther): Move this test to the codegen folder.
import "package:async_helper/async_helper.dart";
import "package:compiler/src/commandline_options.dart";
import "package:compiler/src/common/elements.dart";
import "package:compiler/src/compiler.dart";
@@ -15,6 +14,7 @@ import "package:compiler/src/inferrer/types.dart";
import 'package:compiler/src/inferrer/typemasks/masks.dart';
import 'package:compiler/src/js_model/js_strategy.dart';
import 'package:compiler/src/js_model/js_world.dart' show JClosedWorld;
import "package:expect/async_helper.dart";
import "package:expect/expect.dart";
import 'package:compiler/src/util/memory_compiler.dart';
@@ -2,8 +2,8 @@
// 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/async_helper.dart";
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import '../helpers/compiler_helper.dart';
const String TEST1 = r"""
@@ -4,8 +4,8 @@
// Ensure that unused empty HashMap nodes are dropped from the output.
import 'package:async_helper/async_helper.dart';
import 'package:compiler/compiler_api.dart' as api;
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/util/memory_compiler.dart';
@@ -2,8 +2,8 @@
// 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:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/util/memory_compiler.dart';
@@ -2,8 +2,8 @@
// 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:async_helper/async_helper.dart';
import 'package:compiler/compiler_api.dart' as api;
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/util/memory_compiler.dart';
@@ -4,7 +4,7 @@
// Test that global analysis in dart2js propagates positive integers.
import 'package:async_helper/async_helper.dart';
import 'package:expect/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/util/memory_compiler.dart';

Some files were not shown because too many files have changed in this diff Show More