Commit Graph

304 Commits

Author SHA1 Message Date
gb 9c3e5e995c update fork from master contd 2018-07-28 14:17:37 -04:00
gb ea3b675f28 update fork from master 2018-07-28 13:23:23 -04:00
Matthew Bauer 39100fa19e Fix Nixpkgs evaluation on Functions
Nix says that { f = x: x; } == { g = y: y; }. The rule says to ignore
functions when comparing attribute sets or lists. This commit follows
this rule. However, it is still true that:

(x: x) /= (y: y)

I have also added some tests that check for these cases.

Fixes #323
2018-07-25 21:00:16 -04:00
John Wiegley 9ed0597e40
Update default.nix and .cabal file 2018-07-25 11:53:48 -07:00
Félix Baylac-Jacqué e246bdd647
Add recursive NSelect reduction. 2018-06-26 10:28:33 +02:00
Félix Baylac-Jacqué 721ddd4f53
Test NSelect reduction 2018-06-25 17:19:39 +02:00
Félix Baylac-Jacqué d3cbcf791c
Builtins.div cannot divide by 0
Fixes #277.
2018-06-12 21:54:28 +02:00
Dmitry Rets 1d300ca70f Add tests for __findFile. 2018-05-21 00:29:42 +02:00
John Wiegley dd3b5e4ac6
Disable the pretty parse tests entirely for now 2018-05-14 21:22:07 -07:00
John Wiegley 471712f11f
Switch PrettyPrintTests from QuickCheck to Hedgehog
The reason being that we get better shrinking by default, and no orphan
instances.
2018-05-14 21:22:04 -07:00
Profpatsch 9724c649ce tests: add a shortcut env variable to run all tests
Instead of having to specify all env variables manually, this defaults to
running all tests.
2018-05-15 00:03:39 +02:00
Profpatsch 9cfe060a9d tests: add HPACK_TESTS to make hnix tests conditional
Otherwise requires the `hpack` executable to be in scope, which cannot be
assumed (contrary to the `nix` executable).
2018-05-14 23:56:10 +02:00
John Wiegley d805fa3627
Preserve attr name positions in attrSetAlter 2018-05-10 00:09:42 -07:00
John Wiegley 31f3dc0766
Desugar NSet binds as well as NRecSet, remove an always True parameter
Fixes #310
2018-05-09 15:03:11 -07:00
John Wiegley 37893b3522
Add a presently commented out test, to be restored when #310 is fixed 2018-05-09 14:42:21 -07:00
John Wiegley d191a7587d
Add test case_unsafegetattrpos 2018-05-09 01:43:33 -07:00
John Wiegley a03cf78ce2
Use nix-instantiate --eval --strict for comparison tests 2018-05-09 01:39:29 -07:00
John Wiegley 15baa5c8b8
Track attribute source positions in the binding, not the key name 2018-05-09 01:25:01 -07:00
John Wiegley ba0dc19d2d
Work from mightybyte: Minimize deps required, for building with GHCJS 2018-05-08 16:41:15 -07:00
gb 43c145252d NixString is in its own module hiding the constructors 2018-05-08 16:47:50 -04:00
John Wiegley 4c0d79e769
Remove an import that was causing a warning 2018-05-08 13:12:00 -07:00
John Wiegley 6770046492
During testing, set the store to the current directory 2018-05-08 12:16:13 -07:00
John Wiegley 449d6611df
Remove the Uri type, it's just sugar
Fixes #308
2018-05-08 12:15:50 -07:00
gb fbcb258eb4 Merge branch 'master' of https://github.com/haskell-nix/hnix into string_context_255 2018-05-08 14:44:47 -04:00
John Wiegley aab22fcc68
Set NIX_REMOTE for running the full language tests under Docker 2018-05-07 13:17:44 -07:00
John Wiegley e35a78f067
Always enable the Nix language tests 2018-05-07 12:45:51 -07:00
John Wiegley 080f5ead1d
When running nix-instantiate in the tests, use a temporary store 2018-05-07 12:38:24 -07:00
John Wiegley e6e117f6b7
Disable the builtins.path test for now, until #128 is fixed 2018-05-07 12:06:45 -07:00
John Wiegley 2457efdaa3
Only invoke pretty/parser tests if PRETTY_TESTS=<N> for some N>0 2018-05-06 22:13:30 -07:00
John Wiegley fb5993c0fa
Add some additional testing files 2018-05-06 12:56:43 -07:00
John Wiegley a94f46b7ca
Merge branch 'master' into string_context_255 2018-05-06 12:51:08 -07:00
John Wiegley ce35811f29 Resolve a build warning 2018-05-06 12:30:16 -07:00
John Wiegley 303a010136
Merge branch 'master' into string_context_255 2018-05-06 11:37:46 -07:00
John Wiegley 1a7ec43199 Disable PrettyParseTests for now 2018-05-06 11:14:53 -07:00
John Wiegley f1faf50bcb
Merge branch 'master' into string_context_255 2018-05-06 10:47:23 -07:00
Matthew Pickering b0ed29b3df Add QuickCheck test for pretty printer and parser
I have not spent any time optimising the generated programs but they do
not look totally unreasonable from a cursory inspection.

Fixes #158
2018-05-06 10:31:52 +00:00
gb 8e7d9d32fa add string context 2018-05-03 08:07:54 -04:00
hsloan c1561ea711 Implement builtins.currentTime 2018-05-02 21:32:00 -07:00
Alex Rozenshteyn a355366f32 Add builtins.hasContext 2018-05-02 20:54:51 -07:00
John Wiegley 431006f524
Merge pull request #263 from gdevanla/master
add TopLevel placeHolder to builtins module
2018-05-02 14:19:10 -07:00
John Wiegley dcba116c72 Correct a spelling mistake in the test runner 2018-04-30 21:48:45 -04:00
John Wiegley 84dcb2e378 If a .nix test has no .exp file, just check that it evaluates 2018-04-30 19:12:24 -04:00
Evan Laforge f806ecc5a2 fix bug that made genEvalCompareTests not run any eval-compare tests 2018-04-29 16:50:13 -07:00
Guru Devanla eefc698bde fix type of builtin.placeholder, add tests 2018-04-29 15:10:52 -07:00
John Wiegley 0b6c52eb45 Remove all warnings 2018-04-28 16:26:32 -07:00
John Wiegley dfcb48fce1 Restore verbose error reporting from Nix language tests 2018-04-28 15:30:44 -07:00
Ian-Woo Kim 5de8976d1e add test for div 2018-04-28 14:23:50 -07:00
John Wiegley 7282d7c153 Define builtins.langVersion == 5 (integer), add a matching test with Nix
Fixes #235
2018-04-27 20:55:03 -07:00
John Wiegley 6d2df41a03 Make the search-path test immune to the user's NIX_PATH 2018-04-27 16:45:58 -07:00
John Wiegley 6c2149f767 Remove code TODOs, which have been changed into GitHub issues 2018-04-26 17:13:22 -07:00
John Wiegley 214f85ba70 Restore version of the file where hnix and nix-instantiate disagree 2018-04-25 17:32:44 -07:00
John Wiegley d0e06ce8ad Bring loop.nix down to 26 lines 2018-04-25 17:19:46 -07:00
John Wiegley 038cc22313 Reduce tests/files/loop.nix to 143 lines 2018-04-25 15:47:14 -07:00
John Wiegley 29d2ae4378 Shrink tests/files/loop.nix down to 219 lines 2018-04-25 15:32:53 -07:00
John Wiegley 05ca87a732 Several improvements to error reporting; add new --thunks option 2018-04-25 13:00:41 -07:00
John Wiegley 910b1a8316 Add some new testing files 2018-04-25 10:11:10 -07:00
John Wiegley 68d81dd57c More work on provenance reporting 2018-04-24 23:09:43 -07:00
John Wiegley 2de8c7cf84 More fixes to error reporting 2018-04-24 12:25:40 -07:00
John Wiegley 01bcb86d3f Further improvements to error rendering, but not all done yet 2018-04-24 11:12:20 -07:00
John Wiegley 9864a8c7a5 Rework the way that info frames and error are handled
There is still work to be done to render the new "typed frames", and to
convert all the current string based frame into typed frames. This will pave
the way forward to smarter error messages that can be browsed in intelligent
environments like Emacs and the browser.
2018-04-24 02:15:28 -07:00
John Wiegley 3cf02e3902 Track value provenance during evaluation 2018-04-22 14:33:38 -07:00
Domen Kožar 7ef7a0bb00
Pretty: handle tilde in paths 2018-04-22 15:06:57 +01:00
Kaushik Chakraborty bbb72654d7
Parser: support tilde in paths 2018-04-21 11:47:57 +05:30
John Wiegley 86b09103d6 Move production of a reduced test case to --reduce, improve --trace 2018-04-20 22:36:40 -07:00
Domen Kožar 9fb4047bdc
Pretty: handle variadic params + tests 2018-04-20 01:05:20 +01:00
John Wiegley bb0e0d987c Slight improvements to the pretty printing output 2018-04-19 00:24:01 -07:00
John Wiegley 4163d35a09 nixpkgs allows let with no bindings in some places
At the beginning of arangodb/default.nix:

```
{ stdenv, fetchFromGitHub
, openssl, zlib, python2Packages, readline, cmake, python }:

let
in stdenv.mkDerivation rec {
  version = "3.3.4";
  name    = "arangodb-${version}";
```
2018-04-18 23:42:13 -07:00
John Wiegley 02ee1c7e34 The argument order for the function passed to foldl' had gotten flipped 2018-04-17 18:30:05 -07:00
John Wiegley 4853381832 Add a new case_fixed_points test, based on an example from fixed-points.nix 2018-04-17 18:11:30 -07:00
John Wiegley 03c86aa872 Allow comparison of more value types in the tests 2018-04-17 18:11:26 -07:00
John Wiegley c3f34e62ce Use verbosity to control how much is displayed in error messages 2018-04-17 17:25:59 -07:00
John Wiegley a3c4bbfb76 Use NonEmpty for let bindings and attribute selector paths
Note that Nix allows inherit; and inherit (foo);, so we cannot make the list
of inherited names non-empty, even though the former constructions have no
meaning.
2018-04-17 12:46:41 -07:00
John Wiegley 451ccf7c60 Fix test eval-okay-autoargs 2018-04-15 02:22:33 -07:00
John Wiegley cce65fb106 Add argument processing for the tests; test still not working yet 2018-04-15 02:16:06 -07:00
John Wiegley 169a2140dd Add to the imports listed in Nix.hs 2018-04-14 09:39:03 -07:00
John Wiegley eadf714036 If MATCHING_TESTS=yes (default for Travis), compare eval tests to Nix 2018-04-13 22:34:24 -07:00
Ryan Trinkle 7889e2a9e8 Add a couple of tests for `inherit` scoping 2018-04-14 00:14:26 -04:00
John Wiegley 58b65d2ce1 Don't evaluate to normal form by default in the top level evaluators 2018-04-13 19:29:18 -07:00
John Wiegley 7f6a64da04 More corrections to the search path logic
Fixes #112
2018-04-13 16:37:11 -07:00
John Wiegley 78b185c5b5 Add a strange hack needed to get a test to run 2018-04-13 01:20:58 -07:00
John Wiegley ef489753e7 Fix to find env path 2018-04-13 00:52:09 -07:00
John Wiegley 14bc5360f4 More work on supporting -I and completing env paths 2018-04-13 00:34:49 -07:00
John Wiegley 99189e9536 The basic REPL now works; doesn't allow establishing definitions yet 2018-04-12 16:46:34 -07:00
John Wiegley e6abbdc91e Add two more basic parsing tests 2018-04-12 14:22:55 -07:00
John Wiegley 9a089712aa Create new __includes builtin, set by --include/-I 2018-04-11 22:02:31 -07:00
John Wiegley 90e4a3ec37 Add preliminary parsing of .flags files, though more work is needed 2018-04-11 21:02:37 -07:00
John Wiegley 27c3875934 Use hnix to process nixpkgs in the tests 2018-04-11 13:56:31 -07:00
John Wiegley 978710aa7d Remember how much indentation was stripped from multi-line strings 2018-04-11 12:06:14 -07:00
John Wiegley 3233c9cb31 Restore the pretty show instance for NValue m (orphaned in Pretty for now) 2018-04-10 21:11:46 -07:00
John Wiegley 74de14dc7d Restore the linter, to some degree, at least for the language tests 2018-04-10 21:02:01 -07:00
John Wiegley 01d1ae99a7 Fix ind-string-14 2018-04-10 18:45:57 -07:00
John Wiegley 58345c29f9 Mark ind-string-14.nix as broken, since I have no answer for it now 2018-04-10 18:20:58 -07:00
John Wiegley 2a6ba86ad5 Capitalize a test category name 2018-04-10 17:15:23 -07:00
John Wiegley 481d6fa9c1 Don't ignore errors when parsing nixpkgs 2018-04-10 13:17:37 -07:00
Doug Beardsley 375e6025d3 Break out eval-okay-ind-string into separate tests 2018-04-10 14:57:50 -05:00
John Wiegley dcd081d899 Add directory dependency for the tests 2018-04-10 12:38:14 -07:00
Doug Beardsley 13fc5bcd6d Add builtins.split
Finishes issue #113
2018-04-10 12:33:31 -07:00
John Wiegley a7e7e84795 Drop dependency on insert-ordered-containers
Fixes #161
2018-04-10 11:58:08 -07:00
John Wiegley 84f809a568 Add a test for issue #152 2018-04-10 11:22:54 -07:00
John Wiegley 6d275b6093 Make Nixpkgs parsing test also optional (for now) 2018-04-10 11:14:20 -07:00
John Wiegley 586402ad9a Add a test for parsing all of the nixpkgs that we build with 2018-04-10 11:05:22 -07:00
John Wiegley 9d7f25d368 All is building with Megaparsec now, but many parsing tests fail 2018-04-09 17:12:16 -07:00
John Wiegley 4c2eebbe40 Refactor evaluation using a type class 2018-04-09 00:52:10 -07:00
John Wiegley 3681d51dd6 Create modules Nix.Monad.Lazy, Nix.Monad.Lint, Nix.Monad.Context 2018-04-07 23:14:08 -07:00
Ryan Trinkle 1ada8648f2 Fix comparison of derivations 2018-04-07 20:15:55 -04:00
John Wiegley 85b7799246 Quiet some warnings 2018-04-07 15:15:22 -07:00
John Wiegley c8e9012778 Some minor fixups for compilation 2018-04-07 15:13:58 -07:00
Doug Beardsley 3d98bc8e05 Revert import change 2018-04-07 15:07:09 -07:00
Doug Beardsley 1b7dac071d Test to catch a bug in builtins.match
Also added infrastructure for comparing against current nix behavior,
not just current nix tests.
2018-04-07 15:07:09 -07:00
John Wiegley ea6a98f602 Implement builtins.tryEval 2018-04-07 14:33:15 -07:00
John Wiegley 954ffccebb Ensure in the tests that hnix.cabal is not edited directly 2018-04-07 12:09:49 -07:00
John Wiegley 443129315d Use hpack and move all the Nix sources into a src/ directory 2018-04-07 12:02:33 -07:00
John Wiegley d9047cc216 Factor out some code into new module Nix.Value 2018-04-07 11:38:12 -07:00
John Wiegley 7df47c7d11 Implement builtins.unsafeGetAttrPos
Fixes #117
2018-04-05 23:16:55 -07:00
Doug Beardsley a074ede2f1 Remove old comment 2018-04-05 17:06:00 -06:00
Doug Beardsley 42fbb1faa9 The eval-okay-xml test case passes
Still need to decide what to do with commented out instances
2018-04-05 17:06:00 -06:00
Doug Beardsley 873d0f8ec0 WIP XML serializer for NVClosure
Seems to be working except for mismatches in tag ordering
2018-04-05 17:03:14 -06:00
John Wiegley a1fdb35be0 __curPos requires that we evaluation with location info
Fixes #125
2018-04-05 00:12:27 -07:00
John Wiegley debd240d9d Fix to data presence check 2018-04-04 16:36:15 -07:00
John Wiegley 815748d8ac Update error reports from hnix-tests 2018-04-04 16:33:43 -07:00
Doug Beardsley 06f1bfe508 Merge branch 'master' of github.com:jwiegley/hnix 2018-04-04 16:33:23 -06:00
Doug Beardsley 7281a0732d Fix issue #133 2018-04-04 16:32:21 -06:00
John Wiegley c6f2da7409 Use the ST monad for running the linter
The only place where IO is needed is to read the source file when reporting
errors, so for now I just use unsafeIOToST for this one effect, since it
refers to data that should be immutable for the duration of the linting run.
2018-04-04 13:36:00 -07:00
John Wiegley 766decad90 Fix the hello.nix test file 2018-04-04 09:26:58 -07:00
John Wiegley 2ea17d7000 Make the language tests output a bit less noisy 2018-04-04 00:05:10 -07:00
Ryan Trinkle 49a5b613d1 Use non-tracing evaluator in tests 2018-04-04 02:00:15 -04:00
Ryan Trinkle bc753fda5f Ignore tests ending in ".exp.disabled" 2018-04-03 23:54:29 -04:00
Ryan Trinkle c506464d99 Fix default_value_in_atpattern
Default values are *not* added to @-bound variables in Nix (checked with nix-repl)
2018-04-03 22:21:19 -04:00
John Wiegley 973d6d873b Add an evaluation test for issue #108 2018-04-03 14:43:40 -07:00
John Wiegley c3eb7a94b9 Add basic support for quasi-quotation of Nix expressions in Haskell 2018-04-03 14:21:33 -07:00
Ryan Trinkle 0a6ad5114d Merge branch 'master' of github.com:jwiegley/hnix 2018-04-03 12:36:51 -04:00
John Wiegley c50bf1a9f6 Preserve more information in __cur_file rather than __cwd 2018-04-02 19:57:05 -07:00
Ryan Trinkle 4992eaecbe Fix parsing of 4/2 (it should parse as a path) 2018-04-02 19:50:33 -04:00
John Wiegley 144972f8a3 Correctly propagate unification results to 1 level deep 2018-04-02 15:32:55 -07:00
John Wiegley ffb97610db Generalize the thunking mechanism, so it can be used over Symbolics 2018-04-01 23:48:07 -07:00
John Wiegley d7228c6a75 Move language feature pragmas into each Haskell file, not .cabal 2018-04-01 22:49:12 -07:00
John Wiegley 2e83606451 Simplify the definition of ParamSet 2018-04-01 20:56:57 -07:00
John Wiegley 1dede9334a Correction to the tests 2018-04-01 10:55:23 -07:00
John Wiegley 852aff04e7 Break apart MonadNix, to allow greater flexibility in evaluators 2018-03-31 14:53:38 -07:00
John Wiegley b89b795abe Some improvements to error traces 2018-03-30 23:10:44 -07:00
John Wiegley d08ca26da0 Add informative backtraces on evaluation failure 2018-03-30 23:10:44 -07:00
John Wiegley 74cc1a2ad5 Split MonadNix into evaluation and environmental effects 2018-03-30 14:25:03 -07:00
John Wiegley 9f6c2ba948 Move a lot of code around into new modules 2018-03-30 14:08:38 -07:00
John Wiegley 0b812d5c94 Correctly support 'with' by distinguishing weak scopes from non-weak 2018-03-30 13:18:24 -07:00
John Wiegley a4a2fc0659 Move the linting code into its own module 2018-03-30 12:45:23 -07:00
John Wiegley 22924a591f Implement getEnv, set TEST_VAR=foo for the language tests 2018-03-30 02:16:52 -07:00
John Wiegley c234849fd6 Fix a few tests by making a small change to printNix 2018-03-30 02:07:08 -07:00
John Wiegley 8e944cc223 Fix the tests 2018-03-30 02:00:36 -07:00
John Wiegley b456eba4d6 Add some test files 2018-03-30 01:14:06 -07:00
John Wiegley 4e698d76fa More fixes to lazy evaluation and scoping 2018-03-30 01:11:27 -07:00