Files
sdk/pkg/dartdev/test/experiments_test.dart
T
Daco Harkes 98e29db45c [native_assets] Disable experiment on stable and beta channel
We want to avoid users passing `--enable-experiment=native-assets` on
stable and beta, as we'd like to move fast and break things on the
experiment. This aligns the experiment with how the experiment is
working in Flutter: main and dev branch only.

Before this CL, dartdev did not check experiment flags. Unknown
experiments would fail in the VM. After this CL, dartdev checks the
experiment flags and errors out early.

Change-Id: I875ea3272f4b67342da19ea2e4be329a4b380573
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406660
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-02-04 03:36:43 -08:00

44 lines
1.3 KiB
Dart

// Copyright (c) 2020, 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:dartdev/src/experiments.dart';
import 'package:dartdev/src/sdk.dart';
import 'package:test/test.dart';
void main() {
group('experiments', () {
test('experimentalFeatures', () {
expect(experimentalFeatures, isNotEmpty);
expect(
experimentalFeatures.map((experiment) => experiment.enableString),
contains('test-experiment'),
);
});
test('unknown experiment', () {
final errors = validateExperiments(['foo']);
expect(errors, equals(['Unknown experiment: foo']));
});
test('native assets experiment', () {
final errors = validateExperiments(['native-assets']);
final channel = Runtime.runtime.channel!;
switch (channel) {
case 'stable':
case 'beta':
expect(
errors,
equals([
'Unavailable experiment: native-assets (this experiment is only '
'available on the main, dev channels, this current channel is $channel)',
]),
);
default:
expect(errors, isEmpty);
}
});
});
}