1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tests: add vlib/x/json2 to vtest-cleancode.v

This commit is contained in:
Delyan Angelov
2021-04-11 11:34:08 +03:00
parent c939e4df97
commit 85e9cf1bd3
2 changed files with 9 additions and 4 deletions

View File

@@ -151,7 +151,8 @@ fn (mut s Scanner) text_scan() Token {
if s.text[s.pos] == `"` {
break
} else if !s.text[s.pos].is_hex_digit() {
return s.error('`${s.text[s.pos].ascii_str()}` is not a hex digit')
x := s.text[s.pos].ascii_str()
return s.error('`$x` is not a hex digit')
}
codepoint << s.text[s.pos]
}
@@ -241,9 +242,11 @@ fn (mut s Scanner) num_scan() Token {
// invalid_token returns an error token with the invalid token message.
fn (s Scanner) invalid_token() Token {
if s.text[s.pos] >= 32 && s.text[s.pos] <= 126 {
return s.error('invalid token `${s.text[s.pos].ascii_str()}`')
x := s.text[s.pos].ascii_str()
return s.error('invalid token `$x`')
} else {
return s.error('invalid token ${s.text[s.pos].str_escaped()}')
x := s.text[s.pos].str_escaped()
return s.error('invalid token `$x`')
}
}