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

Side by Side Diff: tests/compiler/dart2js/cps_ir/README.md

Issue 1576093003: cpsir unittests: move all unittests into individual files and test runners. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README and update analyzer_test Created 4 years, 11 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
OLDNEW
(Empty)
1 # CPS IR unit tests
2
3 This folder contains unit tests of the CPS IR. These tests run the compiler with
4 the cps IR and check for the output of a specific function (typically main).
5
6 To make our lives easier, most files here are autogenerated. You should never
7 have to edit a file under `expected/` or any file with an `AUTOGENERATED` header
8 (including the `_test.dart` files).
9
10 See instructions below to add or update tests.
11
12 ### Adding a new test
13
14 Every test has 3 files: an input file, a test runner file, and an expectation
15 file. The last two are auto-generated. Here is how:
16
17 * add a file under `input/` with a unique name, such as `foo_bar.dart`. Do not
18 include `_test` in the name of this file, otherwise the test framework will
19 think this test needs to be run directly in the vm and in a browser, that's
20 not our goal.
21
22 * generate the corresponding test file, by running the `up_to_date_test.dart`
23 passing `update` as an argument:
24
25 ```bash
26 dart tests/compiler/dart2js/cps_ir/up_to_date_test.dart update
27 ```
28
29 This will generate a file `foo_bar_test.dart` on this folder.
30
31 * generate the expectations of the test file by running the generated test file
32 with `update` as an argument:
33
34 ```bash
35 dart --package-root=out/ReleaseX64/packages tests/compiler/dart2js/cps_ir/foo_ba r_test.dart update
36 ```
37
38 This will generate a file `expected/foo_bar.js` with the expected output.
39
40 ### Updating a single test expectation
41
42 To update the expectations of a test, simply regenerate it by running the test
43 file with `update` as an argument:
44
45 ```bash
46 dart --package-root=out/ReleaseX64/packages tests/compiler/dart2js/cps_ir/foo_ba r_test.dart update
47 ```
48
49 This will override the file `expected/foo_bar.js` file with the new output.
50
51 If a test fails because the expectations are out of date, you'll see this
52 suggestion in the failure message too.
53
54 ### Updating all test expectations
55
56 For convenience, we also provide a script to update all expectations at once.
57
58 ```bash
59 dart --package-root=out/ReleaseX64/packages tests/compiler/dart2js/cps_ir/update _all.dart
60 ```
61
62 It is equivalent to update each test individually. This script can be handy when
63 making cross-cutting changes that affect the output of most tests.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698