Skip to content

Commit 9e18b65

Browse files
petebacondarwindylhunn
authored andcommitted
test(compiler-cli): clarify source-map expectations in compliance tests (#43129)
The compliance tests can check source-map segments against expectations encoded into the expectation files. Previously, the encoding of the expected segment was only delimited by whitespace, but this made it difficult to identify segments that started or ended with whitespace. Now these segment expectations are wrapped in double-quotes which makes it easier to read and understand the expectation files. PR Close #43129
1 parent c5250ae commit 9e18b65

62 files changed

Lines changed: 255 additions & 255 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/compiler-cli/test/compliance/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ are intelligently matched to check whether they are equivalent.
131131
To check a mapping, add a `// SOURCE:` comment to the end of a line in an expectation file:
132132

133133
```
134-
<generated code> // SOURCE: "<source-url>" <source code>
134+
<generated code> // SOURCE: "<source-url>" "<source code>"
135135
```
136136

137137
The generated code, stripped of the `// SOURCE: ` comment, will still be checked as normal by the
@@ -144,6 +144,7 @@ Note:
144144
to be `/`.
145145
* Whitespace is important and will be included when comparing the segments.
146146
* There is a single space character between each part of the line.
147+
* Double quotes in the mapping must be escaped.
147148
* Newlines within a mapping must be escaped since the mapping and comment must all appear on a
148149
single line of this file.
149150

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
i0.ɵɵelementStart(0, "div") // SOURCE: "/escaped_chars.html" <div>
1+
i0.ɵɵelementStart(0, "div") // SOURCE: "/escaped_chars.html" "<div>"
22
…
33
// NOTE: the `\\r\\n` at the end of the next line will be unescaped to `\r\n`. If it was just `\r\n` it would get unescaped to the actual characters.
4-
i0.ɵɵtext(1, " Some Message Encoded character: \uD83D\uDE80\\n") // SOURCE: "/escaped_chars.html" Some Message\r\n Encoded character: 🚀\\r\\n
4+
i0.ɵɵtext(1, " Some Message Encoded character: \uD83D\uDE80\\n") // SOURCE: "/escaped_chars.html" "Some Message\r\n Encoded character: 🚀\r\n"
55
…
6-
i0.ɵɵelementEnd() // SOURCE: "/escaped_chars.html" </div>
6+
i0.ɵɵelementEnd() // SOURCE: "/escaped_chars.html" "</div>"
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
.ɵɵelementStart(0, "div") // SOURCE: "/escaped_chars.html" <div>\r\n
1+
.ɵɵelementStart(0, "div") // SOURCE: "/escaped_chars.html" "<div>\r\n "
22
…
3-
// NOTE: the `\\r\\n` at the end of the next line will be unescaped to `\r\n`. If it was just `\r\n` it would get unescaped to the actual characters.
4-
.ɵɵtext(1, " Some Message Encoded character: \uD83D\uDE80\\n") // SOURCE: "/escaped_chars.html" Some Message\r\n Encoded character: 🚀\\r\\n
3+
.ɵɵtext(1, " Some Message Encoded character: \uD83D\uDE80\\n") // SOURCE: "/escaped_chars.html" "Some Message\r\n Encoded character: 🚀\r\n"
54
…
6-
.ɵɵelementEnd() // SOURCE: "/escaped_chars.html" </div>
5+
.ɵɵelementEnd() // SOURCE: "/escaped_chars.html" "</div>"
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
i0.ɵɵelementStart(0, "div") // SOURCE: "/dir/test.html" <div>
1+
i0.ɵɵelementStart(0, "div") // SOURCE: "/dir/test.html" "<div>"
22
…
3-
i0.ɵɵtext(1, "this is a test") // SOURCE: "/dir/test.html" this is a test
3+
i0.ɵɵtext(1, "this is a test") // SOURCE: "/dir/test.html" "this is a test"
44
…
5-
i0.ɵɵelementEnd() // SOURCE: "/dir/test.html" </div>
5+
i0.ɵɵelementEnd() // SOURCE: "/dir/test.html" "</div>"
66
…
7-
i0.ɵɵelementStart(2, "div") // SOURCE: "/dir/test.html" <div>
7+
i0.ɵɵelementStart(2, "div") // SOURCE: "/dir/test.html" "<div>"
88
…
9-
i0.ɵɵtext(3) // SOURCE: "/dir/test.html" {{ 1 + 2 }}
9+
i0.ɵɵtext(3) // SOURCE: "/dir/test.html" "{{ 1 + 2 }}"
1010
…
11-
i0.ɵɵelementEnd() // SOURCE: "/dir/test.html" </div>
11+
i0.ɵɵelementEnd() // SOURCE: "/dir/test.html" "</div>"
1212
…
13-
i0.ɵɵtextInterpolate(1 + 2) // SOURCE: "/dir/test.html" {{ 1 + 2 }}
13+
i0.ɵɵtextInterpolate(1 + 2) // SOURCE: "/dir/test.html" "{{ 1 + 2 }}"
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
.ɵɵelementStart(0, "div") // SOURCE: "/dir/test.html" <div>
1+
.ɵɵelementStart(0, "div") // SOURCE: "/dir/test.html" "<div>"
22
…
3-
.ɵɵtext(1, "this is a test") // SOURCE: "/dir/test.html" this is a test
3+
.ɵɵtext(1, "this is a test") // SOURCE: "/dir/test.html" "this is a test"
44
…
5-
.ɵɵelementEnd() // SOURCE: "/dir/test.html" </div>\n
5+
.ɵɵelementEnd() // SOURCE: "/dir/test.html" "</div>\n"
66
…
7-
.ɵɵelementStart(2, "div") // SOURCE: "/dir/test.html" <div>
7+
.ɵɵelementStart(2, "div") // SOURCE: "/dir/test.html" "<div>"
88
…
9-
.ɵɵtext(3) // SOURCE: "/dir/test.html" {{ 1 + 2 }}
9+
.ɵɵtext(3) // SOURCE: "/dir/test.html" "{{ 1 + 2 }}"
1010
…
1111
// TODO: Work out how to fix the broken segment for the last item in a template
12-
.ɵɵelementEnd() // SOURCE: "/dir/test.html" </div>
12+
.ɵɵelementEnd() // SOURCE: "/dir/test.html" "</div>"
1313
…
14-
.ɵɵtextInterpolate(1 + 2) // SOURCE: "/dir/test.html" {{ 1 + 2 }}
14+
.ɵɵtextInterpolate(1 + 2) // SOURCE: "/dir/test.html" "{{ 1 + 2 }}"
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
i0.ɵɵelementStart(0, "div") // SOURCE: "/extraRootDir/dir/extra.html" <div>
1+
i0.ɵɵelementStart(0, "div") // SOURCE: "/extraRootDir/dir/extra.html" "<div>"
22
…
3-
i0.ɵɵtext(1, "this is a test") // SOURCE: "/extraRootDir/dir/extra.html" this is a test
3+
i0.ɵɵtext(1, "this is a test") // SOURCE: "/extraRootDir/dir/extra.html" "this is a test"
44
…
5-
i0.ɵɵelementEnd() // SOURCE: "/extraRootDir/dir/extra.html" </div>
5+
i0.ɵɵelementEnd() // SOURCE: "/extraRootDir/dir/extra.html" "</div>"
66
…
7-
i0.ɵɵelementStart(2, "div") // SOURCE: "/extraRootDir/dir/extra.html" <div>
7+
i0.ɵɵelementStart(2, "div") // SOURCE: "/extraRootDir/dir/extra.html" "<div>"
88
…
9-
i0.ɵɵtext(3) // SOURCE: "/extraRootDir/dir/extra.html" {{ 1 + 2 }}
9+
i0.ɵɵtext(3) // SOURCE: "/extraRootDir/dir/extra.html" "{{ 1 + 2 }}"
1010
…
11-
i0.ɵɵelementEnd() // SOURCE: "/extraRootDir/dir/extra.html" </div>
11+
i0.ɵɵelementEnd() // SOURCE: "/extraRootDir/dir/extra.html" "</div>"
1212
…
13-
i0.ɵɵtextInterpolate(1 + 2) // SOURCE: "/extraRootDir/dir/extra.html" {{ 1 + 2 }}
13+
i0.ɵɵtextInterpolate(1 + 2) // SOURCE: "/extraRootDir/dir/extra.html" "{{ 1 + 2 }}"
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
.ɵɵelementStart(0, "div") // SOURCE: "/extraRootDir/dir/extra.html" <div>
1+
.ɵɵelementStart(0, "div") // SOURCE: "/extraRootDir/dir/extra.html" "<div>"
22
…
3-
.ɵɵtext(1, "this is a test") // SOURCE: "/extraRootDir/dir/extra.html" this is a test
3+
.ɵɵtext(1, "this is a test") // SOURCE: "/extraRootDir/dir/extra.html" "this is a test"
44
…
5-
.ɵɵelementEnd() // SOURCE: "/extraRootDir/dir/extra.html" </div>\n
5+
.ɵɵelementEnd() // SOURCE: "/extraRootDir/dir/extra.html" "</div>\n"
66
…
7-
.ɵɵelementStart(2, "div") // SOURCE: "/extraRootDir/dir/extra.html" <div>
7+
.ɵɵelementStart(2, "div") // SOURCE: "/extraRootDir/dir/extra.html" "<div>"
88
…
9-
.ɵɵtext(3) // SOURCE: "/extraRootDir/dir/extra.html" {{ 1 + 2 }}
9+
.ɵɵtext(3) // SOURCE: "/extraRootDir/dir/extra.html" "{{ 1 + 2 }}"
1010
…
11-
.ɵɵelementEnd() // SOURCE: "/extraRootDir/dir/extra.html" </div>
11+
.ɵɵelementEnd() // SOURCE: "/extraRootDir/dir/extra.html" "</div>"
1212
…
13-
.ɵɵtextInterpolate(1 + 2) // SOURCE: "/extraRootDir/dir/extra.html" {{ 1 + 2 }}
13+
.ɵɵtextInterpolate(1 + 2) // SOURCE: "/extraRootDir/dir/extra.html" "{{ 1 + 2 }}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
consts: [[1, "some-class"]]
22
…
3-
i0.ɵɵelementStart(0, "div", 0) // SOURCE: "/escape_sequences.ts" <div class=\"some-class\">
3+
i0.ɵɵelementStart(0, "div", 0) // SOURCE: "/escape_sequences.ts" "<div class=\\"some-class\\">"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
consts: [[1, "some-class"]]
22
…
3-
.ɵɵelementStart(0, "div", 0) // SOURCE: "/escape_sequences.ts" <div class=\"some-class\">
3+
.ɵɵelementStart(0, "div", 0) // SOURCE: "/escape_sequences.ts" "<div class=\\"some-class\\">"
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
`Hello, ${ // SOURCE: "/i18n_message_container_tag.ts" Hello,
1+
`Hello, ${ // SOURCE: "/i18n_message_container_tag.ts" "Hello, "
22
…
3-
"\uFFFD#2\uFFFD" // SOURCE: "/i18n_message_container_tag.ts" <b>
3+
"\uFFFD#2\uFFFD" // SOURCE: "/i18n_message_container_tag.ts" "<b>"
44
…
5-
}:START_BOLD_TEXT:World${ // SOURCE: "/i18n_message_container_tag.ts" World
5+
}:START_BOLD_TEXT:World${ // SOURCE: "/i18n_message_container_tag.ts" "World"
66
…
7-
"\uFFFD/#2\uFFFD" // SOURCE: "/i18n_message_container_tag.ts" </b>
7+
"\uFFFD/#2\uFFFD" // SOURCE: "/i18n_message_container_tag.ts" "</b>"
88
…
9-
}:CLOSE_BOLD_TEXT:!` // SOURCE: "/i18n_message_container_tag.ts" !
9+
}:CLOSE_BOLD_TEXT:!` // SOURCE: "/i18n_message_container_tag.ts" "!"
1010
…
11-
i0.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_container_tag.ts" <div i18n>
11+
i0.ɵɵelementStart(0, "div") // SOURCE: "/i18n_message_container_tag.ts" "<div i18n>"
1212
…
13-
i0.ɵɵelementEnd() // SOURCE: "/i18n_message_container_tag.ts" </div>
13+
i0.ɵɵelementEnd() // SOURCE: "/i18n_message_container_tag.ts" "</div>"

0 commit comments

Comments
 (0)