mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
tests/functional/lang: Add tests for builtins.fromTOML overflow
This adds regression tests for fromTOML overflow/underflow behavior. Previous versions of toml11 used to saturate, but this was never an intended behavior (and Snix/Nix 2.3/toml11 >= 4.0 validate this). (cherry picked from Lix [1,2]) [1]:7ee442079d[2]:4de09b6b54
This commit is contained in:
parent
8251305aff
commit
acd627fa46
4 changed files with 28 additions and 0 deletions
13
tests/functional/lang/eval-fail-fromTOML-overflow.err.exp
Normal file
13
tests/functional/lang/eval-fail-fromTOML-overflow.err.exp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error:
|
||||
… while calling the 'fromTOML' builtin
|
||||
at /pwd/lang/eval-fail-fromTOML-overflow.nix:1:1:
|
||||
1| builtins.fromTOML ''attr = 9223372036854775808''
|
||||
| ^
|
||||
2|
|
||||
|
||||
error: while parsing TOML: [error] toml::parse_dec_integer: too large integer: current max digits = 2^63
|
||||
--> fromTOML
|
||||
|
|
||||
1 | attr = 9223372036854775808
|
||||
| ^-- must be < 2^63
|
||||
|
||||
1
tests/functional/lang/eval-fail-fromTOML-overflow.nix
Normal file
1
tests/functional/lang/eval-fail-fromTOML-overflow.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
builtins.fromTOML ''attr = 9223372036854775808''
|
||||
13
tests/functional/lang/eval-fail-fromTOML-underflow.err.exp
Normal file
13
tests/functional/lang/eval-fail-fromTOML-underflow.err.exp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
error:
|
||||
… while calling the 'fromTOML' builtin
|
||||
at /pwd/lang/eval-fail-fromTOML-underflow.nix:1:1:
|
||||
1| builtins.fromTOML ''attr = -9223372036854775809''
|
||||
| ^
|
||||
2|
|
||||
|
||||
error: while parsing TOML: [error] toml::parse_dec_integer: too large integer: current max digits = 2^63
|
||||
--> fromTOML
|
||||
|
|
||||
1 | attr = -9223372036854775809
|
||||
| ^-- must be < 2^63
|
||||
|
||||
1
tests/functional/lang/eval-fail-fromTOML-underflow.nix
Normal file
1
tests/functional/lang/eval-fail-fromTOML-underflow.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
builtins.fromTOML ''attr = -9223372036854775809''
|
||||
Loading…
Add table
Add a link
Reference in a new issue