-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend golden tests to optionally cover augmentations.
- Loading branch information
1 parent
0c22dbf
commit c04ed1d
Showing
12 changed files
with
183 additions
and
56 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,20 @@ | ||
# Golden Tests | ||
|
||
Each `.dart` file under this path creates a test case in | ||
`pkgs/_analyzer_macros/test/golden_test.dart` and | ||
`pkgs/_cfe_macros/test/golden_test.dart`. | ||
|
||
The test case looks for golden files next to the `.dart` file and asserts | ||
that they match. | ||
|
||
## Introspection | ||
|
||
To test introspection, add `.analyzer.json` and/or `.cfe.json` golden files. | ||
The JSON in the golden file is compared with the query output on the `.dart` | ||
file, which must be tagged with the `QueryClass` macro. | ||
|
||
## Application | ||
|
||
To test macro application, add `.analyzer.augmentations` and/or | ||
`.cfe.augmentations` golden files. These are compared with the full | ||
macro augmentation output of the corresponding `.dart` file. |
File renamed without changes.
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,5 @@ | ||
part of 'package:foo/declare_x.dart'; | ||
|
||
augment class Foo { | ||
int get x => 3; | ||
} |
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,5 @@ | ||
augment library 'package:foo/declare_x.dart'; | ||
|
||
augment class Foo { | ||
int get x => 3; | ||
} |
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,8 @@ | ||
// 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. | ||
|
||
import 'package:_test_macros/declare_x_macro.dart'; | ||
|
||
@DeclareX() | ||
class Foo {} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
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