Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: tests/language/library_env_test.dart

Issue 1674613002: Don't expose private libraries with dart.library.X. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 6
7 main() { 7 main() {
8 const NOT_PRESENT = null; 8 const NOT_PRESENT = null;
9 9
10 Expect.isTrue(const bool.fromEnvironment("dart.library.async")); 10 Expect.isTrue(const bool.fromEnvironment("dart.library.async"));
11 Expect.isTrue(const bool.fromEnvironment("dart.library.collection")); 11 Expect.isTrue(const bool.fromEnvironment("dart.library.collection"));
12 Expect.isTrue(const bool.fromEnvironment("dart.library.convert")); 12 Expect.isTrue(const bool.fromEnvironment("dart.library.convert"));
13 Expect.isTrue(const bool.fromEnvironment("dart.library.core")); 13 Expect.isTrue(const bool.fromEnvironment("dart.library.core"));
14 Expect.isTrue(const bool.fromEnvironment("dart.library.typed_data")); 14 Expect.isTrue(const bool.fromEnvironment("dart.library.typed_data"));
15 Expect.isTrue(const bool.fromEnvironment("dart.library.developer"));
16
17 // Internal libraries should not be exposed.
18 print(const bool.fromEnvironment("dart.library._internal"));
Johnni Winther 2016/02/05 12:59:39 Remove debug print?
floitsch 2016/02/05 16:36:42 Done.
19 Expect.equals(NOT_PRESENT,
20 const bool.fromEnvironment("dart.library._internal",
21 defaultValue: NOT_PRESENT));
15 22
16 23
17 bool hasHtmlSupport; 24 bool hasHtmlSupport;
18 hasHtmlSupport = true; /// has_html_support: ok 25 hasHtmlSupport = true; /// has_html_support: ok
19 hasHtmlSupport = false; /// has_no_html_support: ok 26 hasHtmlSupport = false; /// has_no_html_support: ok
20 27
21 if (hasHtmlSupport != null) { 28 if (hasHtmlSupport != null) {
22 bool expectedResult = hasHtmlSupport ? true : NOT_PRESENT; 29 bool expectedResult = hasHtmlSupport ? true : NOT_PRESENT;
23 30
24 Expect.equals(expectedResult, 31 Expect.equals(expectedResult,
(...skipping 14 matching lines...) Expand all
39 Expect.equals(expectedResult, 46 Expect.equals(expectedResult,
40 const bool.fromEnvironment("dart.library.web_sql", 47 const bool.fromEnvironment("dart.library.web_sql",
41 defaultValue: NOT_PRESENT)); 48 defaultValue: NOT_PRESENT));
42 } 49 }
43 50
44 bool hasIoSupport; 51 bool hasIoSupport;
45 hasIoSupport = true; /// has_io_support: ok 52 hasIoSupport = true; /// has_io_support: ok
46 hasIoSupport = false; /// has_no_io_support: ok 53 hasIoSupport = false; /// has_no_io_support: ok
47 54
48 if (hasIoSupport != null) { 55 if (hasIoSupport != null) {
49 bool expectedResult = hasIoSupport ? true : NOT_PRESENT; 56 // Dartium overrides 'dart.library.io' to return "false".
50 57 // We don't test for the non-existance, but just make sure that
51 Expect.equals(expectedResult, 58 // dart.library.io is not set to true.
59 Expect.equals(hasIoSupport,
52 const bool.fromEnvironment("dart.library.io", 60 const bool.fromEnvironment("dart.library.io",
53 defaultValue: NOT_PRESENT)); 61 defaultValue: false));
54 Expect.equals(expectedResult,
55 const bool.fromEnvironment("dart.library.developer",
56 defaultValue: NOT_PRESENT));
57 } 62 }
58 63
59 bool hasMirrorSupport; 64 bool hasMirrorSupport;
60 hasMirrorSupport = true; /// has_mirror_support: ok 65 hasMirrorSupport = true; /// has_mirror_support: ok
61 hasMirrorSupport = false; /// has_no_mirror_support: ok 66 hasMirrorSupport = false; /// has_no_mirror_support: ok
62 67
63 if (hasMirrorSupport != null) { 68 if (hasMirrorSupport != null) {
64 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT; 69 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT;
65 70
66 Expect.equals(expectedResult, 71 Expect.equals(expectedResult,
(...skipping 11 matching lines...) Expand all
78 const bool.fromEnvironment("dart.library.converT", 83 const bool.fromEnvironment("dart.library.converT",
79 defaultValue: NOT_PRESENT)); 84 defaultValue: NOT_PRESENT));
80 Expect.equals(NOT_PRESENT, 85 Expect.equals(NOT_PRESENT,
81 const bool.fromEnvironment("dart.library.", 86 const bool.fromEnvironment("dart.library.",
82 defaultValue: NOT_PRESENT)); 87 defaultValue: NOT_PRESENT));
83 Expect.equals(NOT_PRESENT, 88 Expect.equals(NOT_PRESENT,
84 const bool.fromEnvironment("dart.library.core ", 89 const bool.fromEnvironment("dart.library.core ",
85 defaultValue: NOT_PRESENT)); 90 defaultValue: NOT_PRESENT));
86 91
87 } 92 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698