mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
parser, fmt, gen: support js"string literal"
(#24653)
This commit is contained in:
parent
ee77475dc1
commit
921e00112a
5 changed files with 37 additions and 4 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue