parser, fmt, gen: support js"string literal" (#24653)

This commit is contained in:
Jose Mendoza 2025-06-09 05:24:08 -04:00 committed by GitHub
parent ee77475dc1
commit 921e00112a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 4 deletions

View file

@ -982,3 +982,16 @@ fn test_index_any() {
assert x.index_any('ef') == 4
assert x.index_any('fe') == 4
}
fn test_js_string() {
s := js'hello V'
assert s.charAt(JS.Number(0)) == js'h'
assert s.charAt(JS.Number(6)) == js'V'
assert s.charCodeAt(JS.Number(0)) == JS.Number(104)
assert s.toUpperCase() == js'HELLO V'
assert s.toLowerCase() == js'hello v'
assert s.concat(js' from JS') == js'hello V from JS'
assert s.includes(js' ') == JS.Boolean(true)
assert s.startsWith(js'hello') == JS.Boolean(true)
assert s.endsWith(js'V') == JS.Boolean(true)
}