about summary refs log tree commit diff
path: root/lib/tests
AgeCommit message (Collapse)AuthorFilesLines
2023-07-12lib/tests/modules: Test that _module.args works when a default argument is setRobert Hensing2-0/+31
2023-07-11lib.mergeModules: Add context to error messageRobert Hensing1-1/+1
2023-07-05Merge pull request #240825 from r-burns/mips-embeddedRyan Burns1-1/+1
lib.platforms.mips{,64}-embedded: init
2023-07-05lib/tests: invalidate hashesNaïm Favier2-6/+6
Having the current bash hash present in the nixpkgs tree makes Nix detect bash as a runtime dependency of nixpkgs, which in turns messes up `fetchFromGitHub` due to https://github.com/NixOS/nix/issues/6660
2023-06-30lib.platforms.mips{,64}-embedded: initRyan Burns1-1/+1
2023-06-27lib/tests: remove experimental-featuresNaïm Favier1-3/+0
Now that the lib is tested with Nix 2.3, this isn't needed any more and causes warnings.
2023-06-27lib/tests/modules.sh: Test types.pathInStoreRobert Hensing2-0/+34
Add missing test cases. I think the .links case should be rejected even though it's technically a path in the store.
2023-06-23Merge pull request #238136 from ↵Robert Hensing2-0/+23
hercules-ci/nixos-nixpkgs-dont-check-when-_module.args.pkgs-is-set `nixos/nixpkgs`: Don't check when `_module.args.pkgs` is set
2023-06-22lib/system: move toLosslessStringMaybe into lib/testsAdam Joseph1-2/+18
toLosslessStringMaybe is not used by anything other than lib/tests, so it can be private to that file. I don't think this function was terribly well thought-through. If people start using it, we will become permanently dependent on the ability to test platforms for equality. It also makes the elaboration process more fragile, because it encourages code outside of nixpkgs to become sensitive to the minute details of how elaboration happens.
2023-06-16lib.modules: Add mergeAttrDefinitionsWithPrioRobert Hensing2-0/+23
This will let us make assertions involving _module.args.pkgs, which is not an option but a value attribute, and therefore doesn't have its own highestPrio to inspect. The new function gives us that info.
2023-06-13lib/tests/release.nix: Run systems tests on OfBorgRobert Hensing2-0/+5
2023-06-13lib.systems.equals: Ignore all function attributes reflectivelyRobert Hensing1-1/+1
Co-authored-by: Artturi <Artturin@artturin.com>
2023-06-13lib.systems.{equals,toLosslessStringMaybe}: initRobert Hensing1-8/+53
2023-06-06Merge pull request #235267 from tweag/lazier-findFirstRobert Hensing1-0/+40
`lib.findFirst`: Add tests and make lazier
2023-06-06lib.list.findFirst: Make lazierSilvan Mosberger1-0/+5
There's no need to evaluate list elements after a matching element
2023-06-06lib/tests: Add findFirst testsSilvan Mosberger1-0/+35
2023-06-01Merge pull request #234070 from tweag/pathType-testsRobert Hensing4-103/+110
Init `nixVersions.minimum` and fix `lib` tests for all Nix versions
2023-06-01lib/tests: Also run with nixVersions.minimum and nixVersions.unstableSilvan Mosberger1-48/+58
The previous commits ensure that the tests also succeed with those versions
2023-06-01lib/tests: Fix when run with Nix 2.3Silvan Mosberger2-10/+15
2023-06-01lib/tests/filesystem.sh: Check success and failure separatelySilvan Mosberger1-46/+37
2023-06-01lib.systems.doubles: add big-endian MIPS linux doublesAlyssa Ross1-2/+2
We already have examples for these, but since we didn't actually recognise the doubles, it wasn't possible to build any packages for them without setting allowUnsupportedSystem.
2023-05-25lib.filesystem.pathType: Fix tests for Nix >= 2.14Silvan Mosberger1-2/+3
2023-05-23Merge pull request #224834 from tweag/pathType-and-coRobert Hensing2-0/+95
Improvements to pathType, pathIsDirectory and pathIsRegularFile
2023-05-22lib.filesystem.pathType: Improve error for non-existent pathsSilvan Mosberger1-0/+1
Previously it would fail with error: attribute 'nonexistent' missing at nixpkgs/lib/filesystem.nix:29:10: 28| if dirOf path == path then "directory" 29| else (readDir (dirOf path)).${baseNameOf path}; | ^ 30|
2023-05-22lib.filesystem.pathType: Fix for filesystem root argumentSilvan Mosberger1-0/+3
Previously this function couldn't handle / being passed, it would throw an error: error: attribute '' missing at nixpkgs/lib/filesystem.nix:24:20: 23| */ 24| pathType = path: (readDir (dirOf path)).${baseNameOf path}; | ^ 25| Consequently this also fixes the lib.filesystem.{pathIsDirectory,pathIsRegularFile} functions.
2023-05-22lib.filesystem.pathType and co.: Add testsSilvan Mosberger2-0/+91
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2023-05-20lib/tests: add mkPackageOption testsNaïm Favier2-0/+24
2023-05-06lib.modules: configurationClass -> classRobert Hensing1-1/+1
This simplifies the documentation. `configuration` is implied by `_type`.
2023-05-06lib.modules: in evalModules return move _module.class -> configurationClassRobert Hensing1-0/+1
2023-05-06lib.modules: Change class declaration in module to _classRobert Hensing3-4/+4
2023-05-06lib/tests/modules.sh: Add submodule + class testsRobert Hensing2-1/+49
2023-05-06lib/modules: Move class out of specialArgsRobert Hensing1-3/+3
2023-05-06lib/modules: Only interpret class declaration in non-shorthand modeRobert Hensing3-0/+18
This is to avoid stealing keys from submodules. `class` might be common enough that reinterpreting existing `class` attributes in configurations as a declaration leads to fairly widespread problems.
2023-05-06lib/modules: Explain that a configuration can't be loaded as a moduleRobert Hensing1-1/+1
2023-05-06lib/modules: Improve error when a configuration is importedRobert Hensing2-0/+13
This is appears to be a fairly common mistake for beginners who want to build larger things from the system configurations, such as NixOps networks, etc. Further explanation seems appropriate.
2023-05-06lib/modules: Check against importing things with a _typeRobert Hensing3-0/+12
2023-05-06lib/modules: Add class concept to check importsRobert Hensing4-0/+47
This improves the error message when an incompatible module is imported.
2023-05-06lib/tests/modules.sh: Unload implicit modulesRobert Hensing1-0/+1
I had some trouble understanding this. Let's try to keep new tests a bit more stateless and explicit.
2023-05-05Merge pull request #223407 from AngryAnt/toplist-pathtoonn2-0/+70
lib.toPlist: Add support for path values
2023-05-01Merge pull request #227714 from ony/feature/generateLuarocksConfig-toLuaMatthieu Coudron1-0/+40
lua.lib: use toLua in generateLuarocksConfig
2023-04-29lib.generators.toLua: asBindings optionMykola Orliuk1-0/+40
Allows to generate code block for setting of global variables
2023-04-28Merge pull request #227560 from jackyliu16/loongnix-commitWeijia Wang1-1/+1
lib.platforms.loongarch64: init
2023-04-27lib.platforms.loongarch64: initjackyliu161-1/+1
2023-04-23lib.generators.toLua: allow disabling multilineMykola Orliuk1-2/+7
2023-04-23lib/generators: add toLua/mkLuaInlineMykola Orliuk1-0/+61
Suitable to simplify Lua-based configurations like neovim-lspconfig that might need to interpolate Nix package paths.
2023-03-27lib.toPlist: keep test output in external files for their tab indentsEmil "AngryAnt" Johansen2-46/+47
2023-03-27lib.toPlist: basic test coverageEmil "AngryAnt" Johansen1-0/+69
2023-03-22lib/modules: better error for invalid option declarationsNaïm Favier1-1/+1
Make `byName` aware of whether it's processing options or config to give slightly more accurate error messages.
2023-03-11init: lib.foldlAttrshsjobeki1-0/+31
- provide comprehensive example - add unit test
2023-03-09Merge pull request #211855 from ↵Robert Hensing5-0/+145
hercules-ci/lib-modules-disabledModules-module-with-key lib/modules: Allow an "anonymous" module with key in disabledModules