mirror of
https://github.com/google/go-jsonnet.git
synced 2025-08-07 23:07:14 +02:00
feat: add test data
This commit is contained in:
parent
6e180a9368
commit
5440cc833f
@ -1620,7 +1620,7 @@ func builtinParseInt(i *interpreter, x value) (value, error) {
|
||||
}
|
||||
res, err := strconv.ParseInt(str.getGoString(), 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, i.Error(fmt.Sprintf("%s is not a base 10 integer", str.getGoString()))
|
||||
}
|
||||
return makeValueNumber(float64(res)), nil
|
||||
}
|
||||
|
1
testdata/builtin_parseInt.golden
vendored
Normal file
1
testdata/builtin_parseInt.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
123
|
1
testdata/builtin_parseInt.jsonnet
vendored
Normal file
1
testdata/builtin_parseInt.jsonnet
vendored
Normal file
@ -0,0 +1 @@
|
||||
std.parseInt("123")
|
1
testdata/builtin_parseInt2.golden
vendored
Normal file
1
testdata/builtin_parseInt2.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
-123
|
1
testdata/builtin_parseInt2.jsonnet
vendored
Normal file
1
testdata/builtin_parseInt2.jsonnet
vendored
Normal file
@ -0,0 +1 @@
|
||||
std.parseInt("-123")
|
10
testdata/builtin_parseInt_invalid.golden
vendored
Normal file
10
testdata/builtin_parseInt_invalid.golden
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
RUNTIME ERROR: hello is not a base 10 integer
|
||||
-------------------------------------------------
|
||||
testdata/builtin_parseInt_invalid:1:1-22 $
|
||||
|
||||
std.parseInt("hello")
|
||||
|
||||
-------------------------------------------------
|
||||
During evaluation
|
||||
|
||||
|
1
testdata/builtin_parseInt_invalid.jsonnet
vendored
Normal file
1
testdata/builtin_parseInt_invalid.jsonnet
vendored
Normal file
@ -0,0 +1 @@
|
||||
std.parseInt("hello")
|
10
testdata/builtin_parseInt_invalid_decimal.golden
vendored
Normal file
10
testdata/builtin_parseInt_invalid_decimal.golden
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
RUNTIME ERROR: 123.12 is not a base 10 integer
|
||||
-------------------------------------------------
|
||||
testdata/builtin_parseInt_invalid_decimal:1:1-23 $
|
||||
|
||||
std.parseInt("123.12")
|
||||
|
||||
-------------------------------------------------
|
||||
During evaluation
|
||||
|
||||
|
1
testdata/builtin_parseInt_invalid_decimal.jsonnet
vendored
Normal file
1
testdata/builtin_parseInt_invalid_decimal.jsonnet
vendored
Normal file
@ -0,0 +1 @@
|
||||
std.parseInt("123.12")
|
10
testdata/builtin_parseInt_invalid_hexadecimal.golden
vendored
Normal file
10
testdata/builtin_parseInt_invalid_hexadecimal.golden
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
RUNTIME ERROR: 7B316 is not a base 10 integer
|
||||
-------------------------------------------------
|
||||
testdata/builtin_parseInt_invalid_hexadecimal:1:1-22 $
|
||||
|
||||
std.parseInt("7B316")
|
||||
|
||||
-------------------------------------------------
|
||||
During evaluation
|
||||
|
||||
|
1
testdata/builtin_parseInt_invalid_hexadecimal.jsonnet
vendored
Normal file
1
testdata/builtin_parseInt_invalid_hexadecimal.jsonnet
vendored
Normal file
@ -0,0 +1 @@
|
||||
std.parseInt("7B316")
|
Loading…
Reference in New Issue
Block a user