lix/src/libexpr
Andreas Rammhold 059ae7f6c4
Add unit tests for libexpr (#5377)
* libexpr: fix builtins.split example

The example was previously indicating that multiple whitespaces would be
collapsed into a single captured whitespace. That isn't true and was
likely a mistake when being documented initially.

* Fix segfault on unitilized list when printing value

Since lists are just chunks of memory the individual elements in the
list might be unitilized when a programming error happens within Nix.

In this case the values are null-initialized (at least with Boehm GC)
and we can avoid a nullptr deref when printing them.

I ran into this issue while ensuring that new expression tests would
show the actual value on an assertion failure.

This is unlikely to cause any runtime performance regressions as
printing values is not really in the hot path (unless the repl is the
primary use case).

* Add operator<< for ValueTypes

* Add libexpr tests

This introduces tests for libexpr that evalulate various trivial Nix
language expressions and primop invocations that should be good smoke
tests wheter or not the implementation is behaving as expected.
2022-05-06 18:05:27 +02:00
..
flake Get rid of most .at calls (#6393) 2022-05-04 07:44:32 +02:00
primops store Symbols in a table as well, like positions 2022-04-21 21:56:31 +02:00
tests Add unit tests for libexpr (#5377) 2022-05-06 18:05:27 +02:00
attr-path.cc rename SymbolIdx -> Symbol, Symbol -> SymbolStr 2022-04-25 15:37:01 +02:00
attr-path.hh replace most Pos objects/ptrs with indexes into a position table 2022-04-21 21:46:06 +02:00
attr-set.cc Don't pass Symbol by reference 2022-04-26 13:25:17 +02:00
attr-set.hh Don't pass Symbol by reference 2022-04-26 13:25:17 +02:00
eval-cache.cc Add forgotten null check 2022-05-04 22:13:49 +03:00
eval-cache.hh nix: Respect meta.outputsToInstall, and use all outputs by default 2022-04-26 17:17:27 +02:00
eval-inline.hh replace most Pos objects/ptrs with indexes into a position table 2022-04-21 21:46:06 +02:00
eval.cc Add unit tests for libexpr (#5377) 2022-05-06 18:05:27 +02:00
eval.hh Add unit tests for libexpr (#5377) 2022-05-06 18:05:27 +02:00
fetchurl.nix Move <nix/fetchurl.nix> into the nix binary 2020-12-22 14:43:20 +01:00
function-trace.cc Revert the enum struct change 2020-06-18 22:11:26 +00:00
function-trace.hh replace most Pos objects/ptrs with indexes into a position table 2022-04-21 21:46:06 +02:00
get-drvs.cc Get rid of most .at calls (#6393) 2022-05-04 07:44:32 +02:00
get-drvs.hh nix-env: always print output names in JSON and XML 2022-03-16 21:26:19 +01:00
imported-drv-to-derivation.nix Move some corepkgs into the nix binary 2020-03-11 16:57:48 +01:00
json-to-value.cc return string_views from forceString* 2022-01-27 17:15:43 +01:00
json-to-value.hh return string_views from forceString* 2022-01-27 17:15:43 +01:00
lexer.l replace most Pos objects/ptrs with indexes into a position table 2022-04-21 21:46:06 +02:00
local.mk Merge pull request #5175 from Pamplemousse/make 2021-08-30 12:44:29 +02:00
nix-expr.pc.in pkg-config files: Use c++17 2019-03-14 14:11:12 +01:00
nixexpr.cc rename SymbolIdx -> Symbol, Symbol -> SymbolStr 2022-04-25 15:37:01 +02:00
nixexpr.hh Don't pass Symbol by reference 2022-04-26 13:25:17 +02:00
parser.y rename SymbolIdx -> Symbol, Symbol -> SymbolStr 2022-04-25 15:37:01 +02:00
primops.cc Add unit tests for libexpr (#5377) 2022-05-06 18:05:27 +02:00
primops.hh replace most Pos objects/ptrs with indexes into a position table 2022-04-21 21:46:06 +02:00
symbol-table.hh EvalCache AttrKey: Use Symbol instead of std::string 2022-04-26 14:16:20 +02:00
value-to-json.cc store Symbols in a table as well, like positions 2022-04-21 21:56:31 +02:00
value-to-json.hh replace most Pos objects/ptrs with indexes into a position table 2022-04-21 21:46:06 +02:00
value-to-xml.cc store Symbols in a table as well, like positions 2022-04-21 21:56:31 +02:00
value-to-xml.hh replace most Pos objects/ptrs with indexes into a position table 2022-04-21 21:46:06 +02:00
value.hh rename SymbolIdx -> Symbol, Symbol -> SymbolStr 2022-04-25 15:37:01 +02:00