about summary refs log tree commit diff
path: root/tests/lang
AgeCommit message (Collapse)AuthorFilesLines
2019-05-29 Enable more fromTOML testsEelco Dolstra2-17/+15
cpptoml now parses almost all examples from the spec.
2019-05-29 Fix eval-okay-fromTOML testEelco Dolstra1-1/+1
Turns out we were mis-parsing single-quoted attributes, e.g. 'key2'.
2019-05-28 Merge branch 'attrPaths' of https://github.com/NinjaTrappeur/nixEelco Dolstra6-0/+23
2019-05-08 fix hashfile test that wasn't failing due to eval lazinessWill Dietz1-1/+1
See: https://github.com/NixOS/nix/commit/7becb1bf1c2ec1544a5374580a97b36273506baf#r33450554
2019-05-03 Add builtins.hashFileDaniel Schaefer7-1/+11
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-27 Update eval-okay-types.exp to match #1828Eelco Dolstra1-1/+1
2019-03-24 Add isPath primopzimbatm1-0/+2
this is added for completeness' sake since all the other possible `builtins.typeOf` results have a corresponding `builtins.is<Type>`
2019-01-31 Add builtins.appendContext.Shea Levy1-2/+4
A partner of builtins.getContext, useful for the same reasons.
2019-01-14 Add builtins.getContext.Shea Levy2-0/+23
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-19 FIx floating point evaluationEelco Dolstra2-0/+7
Fixes #2361.
2018-07-05 lib.concatMap and lib.mapAttrs to be builtinsvolth4-0/+10
2018-07-03 Add a fromTOML primopEelco Dolstra2-0/+185
This is primarily useful for processing Cargo.lock files.
2018-05-24 add docs and testsvolth2-1/+5
2018-05-11 Don't return negative numbers from the flex tokenizerEelco Dolstra1-0/+1
Fixes #1374. Closes #2129.
2018-05-02 Fix builtins.add testEelco Dolstra1-1/+1
Nix prints the floating point number 4.0 as "4".
2018-05-01 nix-lang: Add deep nested mixed attrs test case.Félix Baylac-Jacqué1-0/+7
2018-04-29 add tests for builtins.addTim Sears2-0/+9
2018-04-23 Merge branch 'pos-crash-fix' of git://github.com/dezgeg/nixShea Levy2-0/+2
2018-04-23 Merge branch 'add-test-eval-okay-nested-with' of ↵Shea Levy2-0/+4
git://github.com/ryantrinkle/nix
2018-04-18 parser: Allow mixed nested and top-level attrpathsFélix Baylac-Jacqué4-5/+5
Fixes #2077.
2018-04-17 nix-lang parser: Add mixed nested attrs tests.Félix Baylac-Jacqué4-0/+16
Part of issue #2077
2018-04-06 Add missing eval-okay-regex-split.exp test fileDoug Beardsley1-0/+1
2018-04-03 libexpr: Make unsafeGetAttrPos not crash on noPosTuomas Tynkkynen2-0/+2
Currently e.g. `builtins.unsafeGetAttrPos "abort" builtins` will eventually segfault because pos->file is an unset Symbol. Found by afl-fuzz.
2018-03-30 Add test eval-okay-nested-withRyan Trinkle2-0/+4
2018-03-02 libexpr: Recognize newline in more places in lexerTuomas Tynkkynen4-0/+6
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-26 libexpr: Fix prim_replaceStrings() to work on an empty source stringTuomas Tynkkynen2-1/+4
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-21 Revert "libexpr: Fix prim_replaceStrings() to work on an empty source string"Eelco Dolstra2-3/+1
This reverts commit 4ea9707591beceacf9988b3c185faf50da238403. It causes an infinite loop in Nixpkgs evaluation, e.g. "nix-instantiate -A hello" hung. PR #1886.
2018-02-19 libexpr: Fix prim_replaceStrings() to work on an empty source stringTuomas Tynkkynen2-1/+3
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-14 Add splitVersion primop.Shea Levy2-0/+2
Fixes #1868.
2018-02-07 builtins.path test: Don't rely on shlevy's XDG_RUNTIME_DIRShea Levy1-1/+0
2018-02-06 Add path primop.Shea Levy3-0/+9
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-14 Revert "Don't parse "x:x" as a URI"Eelco Dolstra2-3/+2
This reverts commit f90f660b243866b8860eeb24cc4a345d32cc7ce7. This broke Hydra's release.nix, which contained preCheck = ''export LOGNAME=${LOGNAME:-foo}'';
2017-10-30 Don't parse "x:x" as a URIEelco Dolstra2-2/+3
URIs now have to contain "://" or start with "channel:".
2017-08-15 Add builtins.string function.Nicolas B. Pierron1-0/+48
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-18 Update mailing list.Graham Christensen1-1/+1
2017-05-17 Document that builtins.match takes a POSIX extended REEelco Dolstra1-0/+3
2017-05-01 Fix lexer to support `$'` in multiline strings.Guillaume Maudoux2-2/+10
2016-11-27 Improve error message on trailing path slashesGuillaume Maudoux1-0/+6
2016-11-13 Fix comments parsingGuillaume Maudoux2-0/+60
Fixed the parsing of multiline strings ending with an even number of stars, like /** this **/. Added test cases for comments.
2016-08-29 Add builtin function "partition"Eelco Dolstra2-0/+6
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-15 Fix broken number parsing in fromJSONEelco Dolstra1-1/+1
The call to tmp_number.append had its arguments mixed up. Also, JSON does not allow a trailing "," after array/object members.
2016-02-15 Fix test broken by #762Eelco Dolstra1-1/+1
2016-02-12 Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra7-3/+23
Implement floats
2016-02-01 Remove tests/lexer.shEelco Dolstra1-0/+2
"tests/lang.sh" can handle this.
2016-01-06 Adapt tests to show that floats work properly.Christian Theune7-3/+23
2015-11-04 Support SHA-512 hashesEelco Dolstra2-5/+2
Fixes #679. Note: on x86_64, SHA-512 is considerably faster than SHA-256 (198 MB/s versus 131 MB/s).
2015-07-28 Add sort primopEelco Dolstra2-0/+9
2015-07-28 Add primop genListEelco Dolstra1-3/+3
This can be used to implement functions like ‘imap’ (or for that matter, ‘map’) without the quadratic complexity incurred by calling ‘++’ repeatedly.
2015-07-24 Add replaceStrings primopEelco Dolstra2-0/+9
This is a generalisation of replaceChars in Nixpkgs.
2015-07-24 Add concatStringsSep as a primopEelco Dolstra2-0/+9
This fixes the quadratic behaviour of concatStrings/concatStringsSep in Nixpkgs.