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

pull/9681/head
Delyan Angelov 2021-04-11 11:34:08 +03:00
parent c939e4df97
commit 85e9cf1bd3
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 9 additions and 4 deletions

View File

@ -11,7 +11,8 @@ const (
vet_folders = [
'vlib/sqlite',
'vlib/v',
'vlib/x/ttf/',
'vlib/x/json2',
'vlib/x/ttf',
'cmd/v',
'cmd/tools',
'examples/2048',
@ -85,6 +86,7 @@ const (
'vlib/strings/',
'vlib/time/',
'vlib/vweb/',
'vlib/x/json2',
'vlib/x/websocket/',
]
)

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`')
}
}