-
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 more grammar tests
- Loading branch information
Showing
9 changed files
with
300 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,37 @@ | ||
// 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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that a `part` directive may contain a '<configurableUri>' | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
import '../../Utils/expect.dart'; | ||
|
||
part 'grammar_A02_t01_part1.dart' | ||
if (dart.library.io) 'grammar_A02_t01_part2.dart' | ||
if (dart.library.collection) 'grammar_A02_t01_part3.dart'; | ||
|
||
main() { | ||
Expect.isTrue(partId() == "part2" || partId() == "part3"); | ||
} |
31 changes: 31 additions & 0 deletions
31
LanguageFeatures/Parts-with-imports/grammar_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,31 @@ | ||
// 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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that a `part` directive may contain a '<configurableUri>' | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'grammar_A02_t01.dart'; | ||
|
||
String partId() => "part1"; |
31 changes: 31 additions & 0 deletions
31
LanguageFeatures/Parts-with-imports/grammar_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,31 @@ | ||
// 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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that a `part` directive may contain a '<configurableUri>' | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'grammar_A02_t01.dart'; | ||
|
||
String partId() => "part2"; |
31 changes: 31 additions & 0 deletions
31
LanguageFeatures/Parts-with-imports/grammar_A02_t01_part3.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,31 @@ | ||
// 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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that a `part` directive may contain a '<configurableUri>' | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'grammar_A02_t01.dart'; | ||
|
||
String partId() => "part3"; |
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,37 @@ | ||
// 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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that it is a compile-time error to use a | ||
/// <dottedIdentifier> in a `part of` directive. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
library grammar.a03.t01; | ||
part 'grammar_A03_t01_part1.dart'; | ||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
} |
33 changes: 33 additions & 0 deletions
33
LanguageFeatures/Parts-with-imports/grammar_A03_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,33 @@ | ||
// 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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that it is a compile-time error to use a | ||
/// <dottedIdentifier> in a `part of` directive. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of grammar.a03.t01; | ||
// ^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
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,36 @@ | ||
// 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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that it is a compile-time error to use more than one | ||
/// <partHeader>. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'grammar_A04_t01_part1.dart'; | ||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
} |
30 changes: 30 additions & 0 deletions
30
LanguageFeatures/Parts-with-imports/grammar_A04_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,30 @@ | ||
// 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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that it is a compile-time error to use more than one | ||
/// <partHeader>. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'grammar_A04_t01_part1.dart'; |
34 changes: 34 additions & 0 deletions
34
LanguageFeatures/Parts-with-imports/grammar_A04_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,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 We extend the grammar of part files to allow import, export and | ||
/// part file directives. We allow part files directives to use a configurable | ||
/// URI like the other two. We restrict the part of directive to only allow the | ||
/// string version. | ||
/// | ||
/// -- Changed "<uri>" to "<configurableUri>". | ||
/// <partDirective> ::= <metadata> `part' <configurableUri> `;' | ||
/// | ||
/// -- Removed "<dottedIdentifier>" as option, retaining only "<uri>". | ||
/// <partHeader> ::= <metadata> `part' `of' <uri> `;' | ||
/// | ||
/// -- Added "<importOrExport>* <partDirective>*" | ||
/// <partDeclaration> ::= | ||
/// <partHeader> <importOrExport>* <partDirective>* | ||
/// (<metadata> <topLevelDeclaration>)* <EOF> | ||
/// | ||
/// The grammar change is small, mainly adding import, export and part | ||
/// directives to part files. | ||
/// | ||
/// @description Check that it is a compile-time error to use more than one | ||
/// <partHeader>. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
/**/part of 'grammar_A04_t01.dart'; | ||
/**/part of 'grammar_A04_t01_lib.dart'; | ||
// ^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |