mirror of
https://github.com/NixOS/nix
synced 2025-07-12 19:05:08 +02:00
builtins.warn: Require string argument
... so that we may perhaps later extend the interface. Note that Nixpkgs' lib.warn already requires a string coercible argument, so this is reasonable. Also note that string coercible values aren't all strings, but in practice, for warn, they are.
This commit is contained in:
parent
923cbea2af
commit
da82d67022
2 changed files with 8 additions and 10 deletions
|
@ -38,8 +38,10 @@ nix-instantiate --eval -E 'let x = { repeating = x; tracing = builtins.trace x t
|
|||
|
||||
nix-instantiate --eval -E 'builtins.warn "Hello" 123' 2>&1 | grepQuiet 'warning: Hello'
|
||||
nix-instantiate --eval -E 'builtins.addErrorContext "while doing ${"something"} interesting" (builtins.warn "Hello" 123)' 2>/dev/null | grepQuiet 123
|
||||
nix-instantiate --eval -E 'let x = builtins.warn { x = x; } true; in x' \
|
||||
2>&1 | grepQuiet -E 'warning: { x = «potential infinite recursion»; }'
|
||||
|
||||
# warn does not accept non-strings for now
|
||||
expectStderr 1 nix-instantiate --eval -E 'let x = builtins.warn { x = x; } true; in x' \
|
||||
| grepQuiet "expected a string but found a set"
|
||||
expectStderr 1 nix-instantiate --eval --abort-on-warn -E 'builtins.warn "Hello" 123' | grepQuiet Hello
|
||||
NIX_ABORT_ON_WARN=1 expectStderr 1 nix-instantiate --eval -E 'builtins.addErrorContext "while doing ${"something"} interesting" (builtins.warn "Hello" 123)' | grepQuiet "while doing something interesting"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue