mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
x.json2: support time.Time values in encode (#16643)
* feat: json2 time.Time encode
* refactor: best var name
* fix: use 'RFC 3339' as pattern in json encode
* fix: unused var for unaliased_typ
* fix: improve test
* use the clearer test after V ad24c22
, that made format_rfc3339 more stable
Co-authored-by: Delyan Angelov <delian66@gmail.com>
This commit is contained in:
@ -107,11 +107,11 @@ fn test_bool() {
|
||||
// valid conversions
|
||||
assert sample_data['bool'] or { 0 }.bool() == false
|
||||
assert json.Any('true').bool() == true
|
||||
// invalid conversions
|
||||
assert sample_data['int'] or { 0 }.bool() == true
|
||||
assert sample_data['i64'] or { 0 }.bool() == true
|
||||
assert sample_data['f32'] or { 0 }.bool() == true
|
||||
assert sample_data['f64'] or { 0 }.bool() == true
|
||||
// invalid conversions
|
||||
assert sample_data['null'] or { 0 }.bool() == false
|
||||
assert sample_data['arr'] or { 0 }.bool() == false
|
||||
assert sample_data['obj'] or { 0 }.bool() == false
|
||||
|
Reference in New Issue
Block a user