Merge pull request #190818 from IvarWithoutBones/testversion-doc

doc/testers: testVersion -> testers.testVersion, add example

authored by davidak and committed by GitHub 63f7b8c9 3dc04b3a

+11 -5
+11 -5
doc/builders/testers.chapter.md
··· 14 Examples: 15 16 ```nix 17 - passthru.tests.version = testVersion { package = hello; }; 18 19 - passthru.tests.version = testVersion { 20 package = seaweedfs; 21 command = "weed version"; 22 }; 23 24 - passthru.tests.version = testVersion { 25 package = key; 26 command = "KeY --help"; 27 # Wrong '2.5' version in the code. Drop on next version. 28 version = "2.5"; 29 }; 30 ``` 31 32 ## `testEqualDerivation` {#tester-testEqualDerivation} ··· 42 Example: 43 44 ```nix 45 - testEqualDerivation 46 "The hello package must stay the same when enabling checks." 47 hello 48 (hello.overrideAttrs(o: { doCheck = true; })) ··· 73 Example: 74 75 ```nix 76 - tests.fetchgit = invalidateFetcherByDrvHash fetchgit { 77 name = "nix-source"; 78 url = "https://github.com/NixOS/nix"; 79 rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";
··· 14 Examples: 15 16 ```nix 17 + passthru.tests.version = testers.testVersion { package = hello; }; 18 19 + passthru.tests.version = testers.testVersion { 20 package = seaweedfs; 21 command = "weed version"; 22 }; 23 24 + passthru.tests.version = testers.testVersion { 25 package = key; 26 command = "KeY --help"; 27 # Wrong '2.5' version in the code. Drop on next version. 28 version = "2.5"; 29 }; 30 + 31 + passthru.tests.version = testers.testVersion { 32 + package = ghr; 33 + # The output needs to contain the 'version' string without any prefix or suffix. 34 + version = "v${version}"; 35 + }; 36 ``` 37 38 ## `testEqualDerivation` {#tester-testEqualDerivation} ··· 48 Example: 49 50 ```nix 51 + testers.testEqualDerivation 52 "The hello package must stay the same when enabling checks." 53 hello 54 (hello.overrideAttrs(o: { doCheck = true; })) ··· 79 Example: 80 81 ```nix 82 + tests.fetchgit = testers.invalidateFetcherByDrvHash fetchgit { 83 name = "nix-source"; 84 url = "https://github.com/NixOS/nix"; 85 rev = "9d9dbe6ed05854e03811c361a3380e09183f4f4a";