Added escape sequences
This commit is contained in:
@ -15,7 +15,7 @@ var examples = []struct {
|
||||
Output string
|
||||
ExitCode int
|
||||
}{
|
||||
{"hello", "", "Hello", 0},
|
||||
{"hello", "", "Hello\n", 0},
|
||||
{"factorial", "", "120", 0},
|
||||
{"fibonacci", "", "55", 0},
|
||||
{"gcd", "", "21", 0},
|
||||
|
9
tests/programs/escape-rune.q
Normal file
9
tests/programs/escape-rune.q
Normal file
@ -0,0 +1,9 @@
|
||||
main() {
|
||||
assert '\0' == 0
|
||||
assert '\t' == 9
|
||||
assert '\n' == 10
|
||||
assert '\r' == 13
|
||||
assert '\"' == 34
|
||||
assert '\'' == 39
|
||||
assert '\\' == 92
|
||||
}
|
10
tests/programs/escape-string.q
Normal file
10
tests/programs/escape-string.q
Normal file
@ -0,0 +1,10 @@
|
||||
main() {
|
||||
str := "\0\t\n\r\"\'\\"
|
||||
assert str[0] == '\0'
|
||||
assert str[1] == '\t'
|
||||
assert str[2] == '\n'
|
||||
assert str[3] == '\r'
|
||||
assert str[4] == '\"'
|
||||
assert str[5] == '\''
|
||||
assert str[6] == '\\'
|
||||
}
|
@ -24,11 +24,13 @@ var programs = []struct {
|
||||
{"reassign", "", "", 0},
|
||||
{"reuse", "", "", 0},
|
||||
{"return", "", "", 0},
|
||||
{"math", "", "", 0},
|
||||
{"precedence", "", "", 0},
|
||||
{"binary", "", "", 0},
|
||||
{"octal", "", "", 0},
|
||||
{"hexadecimal", "", "", 0},
|
||||
{"math", "", "", 0},
|
||||
{"precedence", "", "", 0},
|
||||
{"escape-rune", "", "", 0},
|
||||
{"escape-string", "", "", 0},
|
||||
{"bitwise-and", "", "", 0},
|
||||
{"bitwise-or", "", "", 0},
|
||||
{"bitwise-xor", "", "", 0},
|
||||
|
Reference in New Issue
Block a user