dart-sdk/tests/corelib/string_from_environment_test.dart
Ben Konyi 848121e6d4 Reland "[ CLI ] Improved consistency of -D and --define across tools and commands"
- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`

Remaining improvements:
- Add support for providing multiple comma separated values for `dart
  run`, `dart`, and `dart2js`

Related issue: https://github.com/dart-lang/sdk/issues/44562

TEST=Updated CLI tests and added new dart2js tests.

This reverts commit e49937769f.

Change-Id: I5f9275b829665eb5e8695403d67f230e752ab0e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183180
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-05 23:53:28 +00:00

15 lines
615 B
Dart

// Copyright (c) 2013, 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.
// SharedOptions=-Da=a -Db=bb -Dc=ccc -Dd= --define=e=eeee
import "package:expect/expect.dart";
main() {
Expect.equals('a', const String.fromEnvironment('a'));
Expect.equals('bb', const String.fromEnvironment('b'));
Expect.equals('ccc', const String.fromEnvironment('c'));
Expect.equals('', const String.fromEnvironment('d'));
Expect.equals('eeee', const String.fromEnvironment('e'));
}