mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
18 lines
800 B
Go
18 lines
800 B
Go
![]() |
|
||
|
fn test_excape_dollar_in_string() {
|
||
|
i := 42
|
||
|
|
||
|
assert '($i)' == '(42)'
|
||
|
assert '(\$i)'.contains('i') && !'(\$i)'.contains('42')
|
||
|
assert !'(\\$i)'.contains('i') && '(\\$i)'.contains('42') && '(\\$i)'.contains('\\')
|
||
|
assert '(\\\$i)'.contains('i') && !'(\\\$i)'.contains('42') && '(\\$i)'.contains('\\')
|
||
|
assert !'(\\\\$i)'.contains('i') && '(\\\\$i)'.contains('42') && '(\\\\$i)'.contains('\\\\')
|
||
|
|
||
|
assert '(${i})' == '(42)'
|
||
|
assert '(\${i})'.contains('i') && !'(\${i})'.contains('42')
|
||
|
assert !'(\\${i})'.contains('i') && '(\\${i})'.contains('42') && '(\\${i})'.contains('\\')
|
||
|
assert '(\\\${i})'.contains('i') && !'(\\\${i})'.contains('42') && '(\\${i})'.contains('\\')
|
||
|
assert !'(\\\\${i})'.contains('i') && '(\\\\${i})'.contains('42') && '(\\\\${i})'.contains('\\\\')
|
||
|
assert i==42
|
||
|
}
|