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

vfmt: change all '$expr' to '${expr}' (#16428)

This commit is contained in:
yuyi
2022-11-15 21:53:13 +08:00
committed by GitHub
parent 56239b4a23
commit 017ace6ea7
859 changed files with 7156 additions and 7135 deletions

View File

@ -164,10 +164,10 @@ pub fn decode_walpha_bytes(input []u8, alphabet Alphabet) ![]u8 {
for _, r in input {
if r > 127 {
panic(@MOD + '.' + @FN +
': high-bit set on invalid digit; outside of ascii range ($r). This should never happen.')
': high-bit set on invalid digit; outside of ascii range (${r}). This should never happen.')
}
if alphabet.decode[r] == -1 {
return error(@MOD + '.' + @FN + ': invalid base58 digit ($r)')
return error(@MOD + '.' + @FN + ': invalid base58 digit (${r})')
}
c = u64(alphabet.decode[r])

View File

@ -57,26 +57,26 @@ fn test_fails() ! {
a := -238
b := 0
if z := encode_int(a) {
return error(@MOD + '.' + @FN + ': expected encode_int to fail, got $z')
return error(@MOD + '.' + @FN + ': expected encode_int to fail, got ${z}')
}
if z := encode_int(b) {
return error(@MOD + '.' + @FN + ': expected encode_int to fail, got $z')
return error(@MOD + '.' + @FN + ': expected encode_int to fail, got ${z}')
}
c := '!'
if z := decode_int(c) {
return error(@MOD + '.' + @FN + ': expected decode_int to fail, got $z')
return error(@MOD + '.' + @FN + ': expected decode_int to fail, got ${z}')
}
if z := decode(c) {
return error(@MOD + '.' + @FN + ': expected decode to fail, got $z')
return error(@MOD + '.' + @FN + ': expected decode to fail, got ${z}')
}
// repeating character
if abc := new_alphabet('aaaaafghij\$lmnopqrstuvwxyz0123456789_ABCDEFGHIJLMNOPQRSTUV') {
return error(@MOD + '.' + @FN + ': expected new_alphabet to fail, got $abc')
return error(@MOD + '.' + @FN + ': expected new_alphabet to fail, got ${abc}')
}
// more than 58 characters long
if abc := new_alphabet('abcdefghij\$lmnopqrstuvwxyz0123456789_ABCDEFGHIJLMNOPQRSTUVWXYZ') {
return error(@MOD + '.' + @FN + ': expected new_alphabet to fail, got $abc')
return error(@MOD + '.' + @FN + ': expected new_alphabet to fail, got ${abc}')
}
}

View File

@ -9,7 +9,7 @@ fn test_encode() {
'\x00\x00hello world': '11StV1DL6CwTryKyV'
} {
output := base58.encode(input)
println('> input: `$input` | $input.bytes().hex() | => output: `$output`')
println('> input: `${input}` | ${input.bytes().hex()} | => output: `${output}`')
assert output == expected
}
}
@ -22,7 +22,7 @@ fn test_encode_int() {
0x636363: 'aPEr'
} {
output := base58.encode_int(input)!
println('> input: 0x${input:x} | => output: `$output`')
println('> input: 0x${input:x} | => output: `${output}`')
assert output == expected
}
}
@ -36,7 +36,7 @@ fn test_decode() {
'3vQB7B6MrGQZaxCuFg4oh': hex.decode('68656c6c6f20776f726c64bc62d4b8')?.bytestr()
} {
input := base58.decode(output)!
println('> output: `$output` | decoded input: `$input` | bytes: $input.bytes().hex()')
println('> output: `${output}` | decoded input: `${input}` | bytes: ${input.bytes().hex()}')
assert input.bytes().hex() == expected.bytes().hex()
}
}