diff options
| author | Daniel Thwaites <danthwaites30@btinternet.com> | 2022-04-27 07:58:20 +0100 |
|---|---|---|
| committer | Robert Hensing <robert@roberthensing.nl> | 2022-05-02 09:05:56 +0200 |
| commit | 7b5be1a0f8e8b0298dd71d78ec01de704d151f3b (patch) | |
| tree | da8c070aa5879d5557c64e1b7d9c5fd5aa423cd3 /lib | |
| parent | lib/strings: convert to string within hasInfix (diff) | |
| download | nixpkgs-7b5be1a0f8e8b0298dd71d78ec01de704d151f3b.tar.gz | |
lib/tests: add tests for hasInfix
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tests/misc.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index c5d1d431677a..a0be581d37fb 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -271,6 +271,36 @@ runTests { ''; }; + testHasInfixFalse = { + expr = hasInfix "c" "abde"; + expected = false; + }; + + testHasInfixTrue = { + expr = hasInfix "c" "abcde"; + expected = true; + }; + + testHasInfixDerivation = { + expr = hasInfix "hello" (import ../.. { system = "x86_64-linux"; }).hello; + expected = true; + }; + + testHasInfixPath = { + expr = hasInfix "tests" ./.; + expected = true; + }; + + testHasInfixPathStoreDir = { + expr = hasInfix builtins.storeDir ./.; + expected = true; + }; + + testHasInfixToString = { + expr = hasInfix "a" { __toString = _: "a"; }; + expected = true; + }; + # LISTS testFilter = { |
