aboutsummaryrefslogtreecommitdiff
path: root/tests/lang
AgeCommit message (Collapse)Author
2019-05-29Enable more fromTOML testsEelco Dolstra
cpptoml now parses almost all examples from the spec.
2019-05-29Fix eval-okay-fromTOML testEelco Dolstra
Turns out we were mis-parsing single-quoted attributes, e.g. 'key2'.
2019-05-28Merge branch 'attrPaths' of https://github.com/NinjaTrappeur/nixEelco Dolstra
2019-05-08fix hashfile test that wasn't failing due to eval lazinessWill Dietz
See: https://github.com/NixOS/nix/commit/7becb1bf1c2ec1544a5374580a97b36273506baf#r33450554
2019-05-03Add builtins.hashFileDaniel Schaefer
For text files it is possible to do it like so: `builtins.hashString "sha256" (builtins.readFile /tmp/a)` but that doesn't work for binary files. With builtins.hashFile any kind of file can be conveniently hashed.
2019-03-27Update eval-okay-types.exp to match #1828Eelco Dolstra
2019-03-24Add isPath primopzimbatm
this is added for completeness' sake since all the other possible `builtins.typeOf` results have a corresponding `builtins.is<Type>`
2019-01-31Add builtins.appendContext.Shea Levy
A partner of builtins.getContext, useful for the same reasons.
2019-01-14Add builtins.getContext.Shea Levy
This can be very helpful when debugging, as well as enabling complex black magic like surgically removing a single dependency from a string's context.
2018-08-19FIx floating point evaluationEelco Dolstra
Fixes #2361.
2018-07-05lib.concatMap and lib.mapAttrs to be builtinsvolth
2018-07-03Add a fromTOML primopEelco Dolstra
This is primarily useful for processing Cargo.lock files.
2018-05-24add docs and testsvolth
2018-05-11Don't return negative numbers from the flex tokenizerEelco Dolstra
Fixes #1374. Closes #2129.
2018-05-02Fix builtins.add testEelco Dolstra
Nix prints the floating point number 4.0 as "4".
2018-05-01nix-lang: Add deep nested mixed attrs test case.Félix Baylac-Jacqué
2018-04-29add tests for builtins.addTim Sears
2018-04-23Merge branch 'pos-crash-fix' of git://github.com/dezgeg/nixShea Levy
2018-04-23Merge branch 'add-test-eval-okay-nested-with' of ↵Shea Levy
git://github.com/ryantrinkle/nix
2018-04-18parser: Allow mixed nested and top-level attrpathsFélix Baylac-Jacqué
Fixes #2077.
2018-04-17nix-lang parser: Add mixed nested attrs tests.Félix Baylac-Jacqué
Part of issue #2077
2018-04-06Add missing eval-okay-regex-split.exp test fileDoug Beardsley
2018-04-03libexpr: Make unsafeGetAttrPos not crash on noPosTuomas Tynkkynen
Currently e.g. `builtins.unsafeGetAttrPos "abort" builtins` will eventually segfault because pos->file is an unset Symbol. Found by afl-fuzz.
2018-03-30Add test eval-okay-nested-withRyan Trinkle
2018-03-02libexpr: Recognize newline in more places in lexerTuomas Tynkkynen
Flex's regexes have an annoying feature: the dot matches everything except a newline. This causes problems for expressions like: "${0}\ " where the backslash-newline combination matches this rule instead of the intended one mentioned in the comment: <STRING>\$|\\|\$\\ { /* This can only occur when we reach EOF, otherwise the above (...|\$[^\{\"\\]|\\.|\$\\.)+ would have triggered. This is technically invalid, but we leave the problem to the parser who fails with exact location. */ return STR; } However, the parser actually accepts the resulting token sequence ('"' DOLLAR_CURLY 0 '}' STR '"'), which is a problem because the lexer rule didn't assign anything to yylval. Ultimately this leads to a crash when dereferencing a NULL pointer in ExprConcatStrings::bindVars(). The fix does change the syntax of the language in some corner cases but I think it's only turning previously invalid (or crashing) syntax to valid syntax. E.g. "a\ b" and ''a''\ b'' were previously syntax errors but now both result in "a\nb". Found by afl-fuzz.
2018-02-26libexpr: Fix prim_replaceStrings() to work on an empty source stringTuomas Tynkkynen
Otherwise, running e.g. nix-instantiate --eval -E --strict 'builtins.replaceStrings [""] ["X"] "abc"' would just hang in an infinite loop. Found by afl-fuzz. First attempt of this was reverted in e2d71bd1862cdda because it caused another infinite loop, which is fixed now and a test added.
2018-02-21Revert "libexpr: Fix prim_replaceStrings() to work on an empty source string"Eelco Dolstra
This reverts commit 4ea9707591beceacf9988b3c185faf50da238403. It causes an infinite loop in Nixpkgs evaluation, e.g. "nix-instantiate -A hello" hung. PR #1886.
2018-02-19libexpr: Fix prim_replaceStrings() to work on an empty source stringTuomas Tynkkynen
Otherwise, running e.g. nix-instantiate --eval -E --strict 'builtins.replaceStrings [""] ["X"] "abc"' would just hang in an infinite loop. Found by afl-fuzz.
2018-02-14Add splitVersion primop.Shea Levy
Fixes #1868.
2018-02-07builtins.path test: Don't rely on shlevy's XDG_RUNTIME_DIRShea Levy
2018-02-06Add path primop.Shea Levy
builtins.path allows specifying the name of a path (which makes paths with store-illegal names now addable), allows adding paths with flat instead of recursive hashes, allows specifying a filter (so is a generalization of filterSource), and allows specifying an expected hash (enabling safe path adding in pure mode).
2017-11-14Revert "Don't parse "x:x" as a URI"Eelco Dolstra
This reverts commit f90f660b243866b8860eeb24cc4a345d32cc7ce7. This broke Hydra's release.nix, which contained preCheck = ''export LOGNAME=${LOGNAME:-foo}'';
2017-10-30Don't parse "x:x" as a URIEelco Dolstra
URIs now have to contain "://" or start with "channel:".
2017-08-15Add builtins.string function.Nicolas B. Pierron
The function 'builtins.split' takes a POSIX extended regular expression and an arbitrary string. It returns a list of non-matching substring interleaved by lists of matched groups of the regular expression. ```nix with builtins; assert split "(a)b" "abc" == [ "" [ "a" ] "c" ]; assert split "([ac])" "abc" == [ "" [ "a" ] "b" [ "c" ] "" ]; assert split "(a)|(c)" "abc" == [ "" [ "a" null ] "b" [ null "c" ] "" ]; assert split "([[:upper:]]+)" " FOO " == [ " " [ "FOO" ] " " ]; ```
2017-07-18Update mailing list.Graham Christensen
2017-05-17Document that builtins.match takes a POSIX extended REEelco Dolstra
2017-05-01Fix lexer to support `$'` in multiline strings.Guillaume Maudoux
2016-11-27Improve error message on trailing path slashesGuillaume Maudoux
2016-11-13Fix comments parsingGuillaume Maudoux
Fixed the parsing of multiline strings ending with an even number of stars, like /** this **/. Added test cases for comments.
2016-08-29Add builtin function "partition"Eelco Dolstra
The implementation of "partition" in Nixpkgs is O(n^2) (because of the use of ++), and for some reason was causing stack overflows in multi-threaded evaluation (not sure why). This reduces "nix-env -qa --drv-path" runtime by 0.197s and memory usage by 298 MiB (in non-Boehm mode).
2016-02-15Fix broken number parsing in fromJSONEelco Dolstra
The call to tmp_number.append had its arguments mixed up. Also, JSON does not allow a trailing "," after array/object members.
2016-02-15Fix test broken by #762Eelco Dolstra
2016-02-12Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra
Implement floats
2016-02-01Remove tests/lexer.shEelco Dolstra
"tests/lang.sh" can handle this.
2016-01-06Adapt tests to show that floats work properly.Christian Theune
2015-11-04Support SHA-512 hashesEelco Dolstra
Fixes #679. Note: on x86_64, SHA-512 is considerably faster than SHA-256 (198 MB/s versus 131 MB/s).
2015-07-28Add sort primopEelco Dolstra
2015-07-28Add primop genListEelco Dolstra
This can be used to implement functions like ‘imap’ (or for that matter, ‘map’) without the quadratic complexity incurred by calling ‘++’ repeatedly.
2015-07-24Add replaceStrings primopEelco Dolstra
This is a generalisation of replaceChars in Nixpkgs.
2015-07-24Add concatStringsSep as a primopEelco Dolstra
This fixes the quadratic behaviour of concatStrings/concatStringsSep in Nixpkgs.