-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add export directive tests
- Loading branch information
Showing
15 changed files
with
374 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. | ||
/// | ||
/// @description Check that an export directive contained in a part file of a | ||
/// library is added to the library's export scope. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
import 'export_A01_t01_lib.dart'; | ||
import '../../Utils/expect.dart'; | ||
|
||
main() { | ||
// From parts_lib.dart | ||
Expect.equals("libVar", libVar); | ||
Expect.equals("libGetter", libGetter); | ||
libSetter = "x"; | ||
Expect.equals("libFunc", libFunc); | ||
Expect.equals("LibClass", LibClass.id); | ||
Expect.equals("LibMixin", LibMixin.id); | ||
Expect.equals("LibEnum", LibEnum.id); | ||
Expect.equals("LibExt", LibExt.id); | ||
Expect.equals("LibET", LibET.id); | ||
// From scope_lib2.dart | ||
Expect.equals("scope_lib2", libId); | ||
Expect.equals("scope_lib2 lib2Func", lib2Func()); | ||
} |
17 changes: 17 additions & 0 deletions
17
LanguageFeatures/Parts-with-imports/export_A01_t01_lib.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. | ||
/// | ||
/// @description Check that an export directive contained in a part file of a | ||
/// library is added to the library's export scope. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'export_A01_t01_part1.dart'; |
21 changes: 21 additions & 0 deletions
21
LanguageFeatures/Parts-with-imports/export_A01_t01_part1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. | ||
/// | ||
/// @description Check that an export directive contained in a part file of a | ||
/// library is added to the library's export scope. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'export_A01_t01_lib.dart'; | ||
|
||
export 'parts_lib.dart'; | ||
|
||
part 'export_A01_t01_part2.dart'; |
19 changes: 19 additions & 0 deletions
19
LanguageFeatures/Parts-with-imports/export_A01_t01_part2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. | ||
/// | ||
/// @description Check that an export directive contained in a part file of a | ||
/// library is added to the library's export scope. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'export_A01_t01_part1.dart'; | ||
|
||
export 'scope_lib2.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. | ||
/// | ||
/// @description Check that it is a compile-time error to access members of an | ||
/// exported library hidden by `show` and `hide`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
import 'export_A01_t02_lib.dart'; | ||
|
||
main() { | ||
// From parts_lib.dart | ||
print(libVar); | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
print(libGetter); | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
libSetter = "x"; | ||
//^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
print(libFunc); | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
print(LibClass); // Ok | ||
print(LibMixin); | ||
// ^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
print(LibEnum); | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
print(LibExt.id); | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
print(LibET); | ||
// ^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
// From scope_lib2.dart | ||
print(libId); // Ok | ||
print(lib2Func()); | ||
// ^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} |
17 changes: 17 additions & 0 deletions
17
LanguageFeatures/Parts-with-imports/export_A01_t02_lib.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. | ||
/// | ||
/// @description Check that it is a compile-time error to access members of an | ||
/// exported library hidden by `show` and `hide`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'export_A01_t02_part1.dart'; |
21 changes: 21 additions & 0 deletions
21
LanguageFeatures/Parts-with-imports/export_A01_t02_part1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. | ||
/// | ||
/// @description Check that it is a compile-time error to access members of an | ||
/// exported library hidden by `show` and `hide`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'export_A01_t02_lib.dart'; | ||
|
||
export 'parts_lib.dart' show LibClass; | ||
|
||
part 'export_A01_t02_part2.dart'; |
19 changes: 19 additions & 0 deletions
19
LanguageFeatures/Parts-with-imports/export_A01_t02_part2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. | ||
/// | ||
/// @description Check that it is a compile-time error to access members of an | ||
/// exported library hidden by `show` and `hide`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'export_A01_t02_part1.dart'; | ||
|
||
export 'scope_lib2.dart' hide lib2Func; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. Conflicts are handled as usual (as an | ||
/// error if it’s not the same declaration). | ||
/// | ||
/// @description Check that it's not an error to export the same declaration | ||
/// more than once. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
import 'export_A02_t01_lib.dart'; | ||
import '../../Utils/expect.dart'; | ||
|
||
main() { | ||
// From parts_lib.dart | ||
Expect.equals("libVar", libVar); | ||
Expect.equals("libGetter", libGetter); | ||
libSetter = "x"; | ||
Expect.equals("libFunc", libFunc); | ||
Expect.equals("LibClass", LibClass.id); | ||
Expect.equals("LibMixin", LibMixin.id); | ||
Expect.equals("LibEnum", LibEnum.id); | ||
Expect.equals("LibExt", LibExt.id); | ||
Expect.equals("LibET", LibET.id); | ||
// From scope_lib2.dart | ||
Expect.equals("scope_lib2", libId); | ||
Expect.equals("scope_lib2 lib2Func", lib2Func()); | ||
} |
18 changes: 18 additions & 0 deletions
18
LanguageFeatures/Parts-with-imports/export_A02_t01_lib.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. Conflicts are handled as usual (as an | ||
/// error if it’s not the same declaration). | ||
/// | ||
/// @description Check that it's not an error to export the same declaration | ||
/// more than once. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'export_A02_t01_part1.dart'; |
24 changes: 24 additions & 0 deletions
24
LanguageFeatures/Parts-with-imports/export_A02_t01_part1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. Conflicts are handled as usual (as an | ||
/// error if it’s not the same declaration). | ||
/// | ||
/// @description Check that it's not an error to export the same declaration | ||
/// more than once. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'export_A02_t01_lib.dart'; | ||
|
||
export 'parts_lib.dart'; | ||
export 'parts_lib.dart'; | ||
export 'scope_lib2.dart'; | ||
|
||
part 'export_A02_t01_part2.dart'; |
20 changes: 20 additions & 0 deletions
20
LanguageFeatures/Parts-with-imports/export_A02_t01_part2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. Conflicts are handled as usual (as an | ||
/// error if it’s not the same declaration). | ||
/// | ||
/// @description Check that it's not an error to export the same declaration | ||
/// more than once. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'export_A02_t01_part1.dart'; | ||
|
||
export 'scope_lib2.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. Conflicts are handled as usual (as an | ||
/// error if it’s not the same declaration). | ||
/// | ||
/// @description Check that it is a compile-time error if exported libraries | ||
/// have a name conflict. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'export_A02_t02_part1.dart'; | ||
|
||
main() { | ||
} |
25 changes: 25 additions & 0 deletions
25
LanguageFeatures/Parts-with-imports/export_A02_t02_part1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. Conflicts are handled as usual (as an | ||
/// error if it’s not the same declaration). | ||
/// | ||
/// @description Check that it is a compile-time error if exported libraries | ||
/// have a name conflict. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'export_A02_t02.dart'; | ||
|
||
export 'parts_lib.dart'; | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
part 'export_A02_t02_part2.dart'; |
23 changes: 23 additions & 0 deletions
23
LanguageFeatures/Parts-with-imports/export_A02_t02_part2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
/// @assertion Any Dart file can contain an `export` directive. It makes no | ||
/// difference which file an `export` is in, its declarations (filtered by any | ||
/// `hide` or `show` modifiers) are added to the library’s single export scope, | ||
/// along with those of any other `exports` in the library and the non-private | ||
/// declarations of the library itself. Conflicts are handled as usual (as an | ||
/// error if it’s not the same declaration). | ||
/// | ||
/// @description Check that it is a compile-time error if exported libraries | ||
/// have a name conflict. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'export_A02_t02_part1.dart'; | ||
|
||
export 'scope_lib1.dart'; | ||
// ^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |