Skip to content

Commit 38bfc61

Browse files
committed
[SwiftParser] Add a test case for the edge continuation byte
1 parent 9b2f29f commit 38bfc61

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Tests/SwiftParserTest/LexerTests.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,4 +1504,23 @@ public class LexerTests: ParserTestCase {
15041504
]
15051505
)
15061506
}
1507+
1508+
func testUnicodeContainTheEdgeContinuationByte() {
1509+
// A continuation byte must be in the range greater than or
1510+
// equal to 0x80 and less than or equal to 0xBF
1511+
1512+
// À(0xC3 0x80), 㗀(0xE3 0x97 0x80), 🀀(0xF0 0x9F 0x80 0x80),
1513+
// ÿ(0xC3 0xBF), 俿(0xE4 0xBF 0xBF), 𐐿(0xF0 0x90 0x90 0xBF)
1514+
assertLexemes(
1515+
"À 㗀 🀀 ÿ 俿 𐐿",
1516+
lexemes: [
1517+
LexemeSpec(.identifier, text: "À", trailing: " "),
1518+
LexemeSpec(.identifier, text: "", trailing: " "),
1519+
LexemeSpec(.identifier, text: "🀀", trailing: " "),
1520+
LexemeSpec(.identifier, text: "ÿ", trailing: " "),
1521+
LexemeSpec(.identifier, text: "俿", trailing: " "),
1522+
LexemeSpec(.identifier, text: "𐐿"),
1523+
]
1524+
)
1525+
}
15071526
}

0 commit comments

Comments
 (0)