aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2022-05-06 18:05:27 +0200
committerGitHub <noreply@github.com>2022-05-06 18:05:27 +0200
commit059ae7f6c4b491d728714207c082a03d94c06744 (patch)
tree6d87fe0cf1b62ea28882ab18e476ee694d121099 /src/libexpr/eval.hh
parentb470218d9a89bc29116853260a01af6cab450dae (diff)
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.
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 6c418f2ae..774bc17bb 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -55,6 +55,7 @@ typedef std::map<Path, StorePath> SrcToStore;
std::ostream & printValue(const EvalState & state, std::ostream & str, const Value & v);
std::string printValue(const EvalState & state, const Value & v);
+std::ostream & operator << (std::ostream & os, const ValueType t);
typedef std::pair<std::string, std::string> SearchPathElem;