mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
decoder2: fix number decoding and improve errors (#25015)
This commit is contained in:
parent
c49b9da04e
commit
f03d800800
8 changed files with 552 additions and 225 deletions
|
@ -90,8 +90,12 @@ fn test_required_attribute() {
|
|||
mut has_error := false
|
||||
|
||||
json.decode[StruWithRequiredAttribute]('{"name": "hola", "a": 2, "b": 3}') or {
|
||||
if err is json.JsonDecodeError {
|
||||
assert err.line == 1
|
||||
assert err.character == 31
|
||||
assert err.message == 'Data: missing required field `skip_and_required`'
|
||||
}
|
||||
has_error = true
|
||||
assert err.msg() == 'missing required field `skip_and_required`'
|
||||
}
|
||||
|
||||
assert has_error, '`required` attribute not working. It should have failed'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue