Files
sdk/pkg/dartdev/test/native_assets/test_test.dart
T
Daco Harkes 72dd200f8a [pkg][dartdev] Error on native assets but not enabled
And only print logs if `-v` is passed.

TEST=pkg/dartdev/test/native_assets/

Bug: https://github.com/dart-lang/sdk/issues/50565
Change-Id: Iccf879c80ea01cb39f9dd0d13c2f515a885d11d2
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314721
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
2023-07-24 11:25:06 +00:00

77 lines
2.0 KiB
Dart

// Copyright (c) 2023, 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.
// @dart=2.18
import 'package:test/test.dart';
import '../utils.dart';
import 'helpers.dart';
void main(List<String> args) async {
// No --source option, `dart run` from source does not output target program
// stdout.
test('dart test', timeout: longTimeout, () async {
await nativeAssetsTest('native_add', (packageUri) async {
final result = await runDart(
arguments: [
'--enable-experiment=native-assets',
'test',
],
workingDirectory: packageUri,
logger: logger,
);
expect(
result.stdout,
stringContainsInOrder(
[
'native add test',
'All tests passed!',
],
),
);
});
});
test('dart run test:test', timeout: longTimeout, () async {
await nativeAssetsTest('native_add', (packageUri) async {
final result = await runDart(
arguments: [
'--enable-experiment=native-assets',
'run',
'test:test',
],
workingDirectory: packageUri,
logger: logger,
);
expect(
result.stdout,
stringContainsInOrder(
[
'native add test',
'All tests passed!',
],
),
);
});
});
test('dart build native assets disabled', timeout: longTimeout, () async {
await nativeAssetsTest('dart_app', (dartAppUri) async {
final result = await runDart(
arguments: [
'test',
],
workingDirectory: dartAppUri,
logger: logger,
expectExitCodeZero: false,
);
expect(result.exitCode, isNot(0));
expect(result.stderr, contains('Enable native assets'));
expect(result.stderr, contains('native_add'));
});
});
}