mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
5b5d0bbb9c
commit
1d41d9daf9
@ -69,10 +69,7 @@ pub fn (f Any) json_str() string {
|
||||
string {
|
||||
return json_string(f)
|
||||
}
|
||||
int {
|
||||
return f.str()
|
||||
}
|
||||
u64, i64 {
|
||||
bool, int, u64, i64 {
|
||||
return f.str()
|
||||
}
|
||||
f32 {
|
||||
@ -89,9 +86,6 @@ pub fn (f Any) json_str() string {
|
||||
}
|
||||
return str_f64
|
||||
}
|
||||
bool {
|
||||
return f.str()
|
||||
}
|
||||
map[string]Any {
|
||||
return f.str()
|
||||
}
|
||||
|
@ -15,6 +15,14 @@ fn test_json_escape_low_chars() {
|
||||
fn test_json_string() {
|
||||
text := json2.Any('te✔st')
|
||||
assert text.json_str() == r'te\u2714st'
|
||||
boolean := json2.Any(true)
|
||||
assert boolean.json_str() == 'true'
|
||||
integer := json2.Any(int(-5))
|
||||
assert integer.json_str() == '-5'
|
||||
u64integer := json2.Any(u64(5000))
|
||||
assert u64integer.json_str() == '5000'
|
||||
i64integer := json2.Any(i64(-17))
|
||||
assert i64integer.json_str() == '-17'
|
||||
}
|
||||
|
||||
fn test_json_string_emoji() {
|
||||
|
Loading…
Reference in New Issue
Block a user