toml: fix iarna test

pull/13654/head
Ned Palacios 2022-03-04 15:21:18 +08:00
parent 8d0717122d
commit 0eb405076d
1 changed files with 3 additions and 3 deletions

View File

@ -296,7 +296,7 @@ fn to_iarna(value ast.Value, skip_value_map bool) string {
// Normalization for json // Normalization for json
mut json_text := json2.Any(value.text).json_str().to_upper().replace(' ', mut json_text := json2.Any(value.text).json_str().to_upper().replace(' ',
'T') 'T')
typ := if json_text.ends_with('Z') || json_text.all_after('T').contains('-') typ := if json_text.ends_with('Z"') || json_text.all_after('T').contains('-')
|| json_text.all_after('T').contains('+') { || json_text.all_after('T').contains('+') {
'datetime' 'datetime'
} else { } else {
@ -306,11 +306,11 @@ fn to_iarna(value ast.Value, skip_value_map bool) string {
// It seems it's implementation specific how time and // It seems it's implementation specific how time and
// date-time values are represented in detail. For now we follow the BurntSushi format // date-time values are represented in detail. For now we follow the BurntSushi format
// that expands to 6 digits which is also a valid RFC 3339 representation. // that expands to 6 digits which is also a valid RFC 3339 representation.
json_text = to_iarna_time(json_text) json_text = to_iarna_time(json_text[1..json_text.len - 1])
if skip_value_map { if skip_value_map {
return json_text return json_text
} }
return '{ "type": "$typ", "value": $json_text }' return '{ "type": "$typ", "value": "$json_text" }'
} }
ast.Date { ast.Date {
json_text := json2.Any(value.text).json_str() json_text := json2.Any(value.text).json_str()