|
25 | 25 | pkgs = import inputs.nixpkgs { |
26 | 26 | inherit system overlays; |
27 | 27 | }; |
| 28 | + integrationTestPatch = pkgs.writeTextFile { |
| 29 | + name = "integration-tests-nix-fix.patch"; |
| 30 | + text = |
| 31 | + # patch |
| 32 | + '' |
| 33 | + diff --git a/tests/main.rs b/tests/main.rs |
| 34 | + index c19811d..33c3829 100644 |
| 35 | + --- a/tests/main.rs |
| 36 | + +++ b/tests/main.rs |
| 37 | + @@ -15,7 +15,7 @@ fn failure_with_invalid_config() { |
| 38 | + let config_file = dir.path().join("nufmt.nuon"); |
| 39 | + fs::write(&config_file, r#"{unknown: 1}"#).unwrap(); |
| 40 | +
|
| 41 | + - let output = Command::new("target/debug/nufmt") |
| 42 | + + let output = Command::new("target/@target_triple@/release/nufmt") |
| 43 | + .arg("--config") |
| 44 | + .arg(config_file.to_str().unwrap()) |
| 45 | + .arg(dir.path().to_str().unwrap()) |
| 46 | + @@ -29,7 +29,7 @@ fn failure_with_invalid_config() { |
| 47 | +
|
| 48 | + #[test] |
| 49 | + fn failure_with_invalid_config_file() { |
| 50 | + - let output = Command::new("target/debug/nufmt") |
| 51 | + + let output = Command::new("target/@target_triple@/release/nufmt") |
| 52 | + .arg("--config") |
| 53 | + .arg("path/that/does/not/exist/nufmt.nuon") |
| 54 | + .output() |
| 55 | + @@ -42,7 +42,7 @@ fn failure_with_invalid_config_file() { |
| 56 | +
|
| 57 | + #[test] |
| 58 | + fn failure_with_invalid_file_to_format() { |
| 59 | + - let output = Command::new("target/debug/nufmt") |
| 60 | + + let output = Command::new("target/@target_triple@/release/nufmt") |
| 61 | + .arg("path/that/does/not/exist/a.nu") |
| 62 | + .output() |
| 63 | + .unwrap(); |
| 64 | + @@ -56,7 +56,7 @@ fn failure_with_invalid_file_to_format() { |
| 65 | + fn warning_when_no_files_are_detected() { |
| 66 | + let dir = tempdir().unwrap(); |
| 67 | +
|
| 68 | + - let output = Command::new("target/debug/nufmt") |
| 69 | + + let output = Command::new("target/@target_triple@/release/nufmt") |
| 70 | + .arg("--dry-run") |
| 71 | + .arg(dir.path().to_str().unwrap()) |
| 72 | + .output() |
| 73 | + @@ -75,7 +75,7 @@ fn warning_is_displayed_when_no_files_are_detected_with_excluded_files() { |
| 74 | + fs::write(&config_file, r#"{exclude: ["a*"]}"#).unwrap(); |
| 75 | + fs::write(&file_a, INVALID).unwrap(); |
| 76 | +
|
| 77 | + - let output = Command::new("target/debug/nufmt") |
| 78 | + + let output = Command::new("target/@target_triple@/release/nufmt") |
| 79 | + .arg("--config") |
| 80 | + .arg(config_file.to_str().unwrap()) |
| 81 | + .arg("--dry-run") |
| 82 | + @@ -98,7 +98,7 @@ fn files_are_reformatted() { |
| 83 | + fs::write(&file_a, INVALID).unwrap(); |
| 84 | + fs::write(&file_b, INVALID).unwrap(); |
| 85 | +
|
| 86 | + - let output = Command::new("target/debug/nufmt") |
| 87 | + + let output = Command::new("target/@target_triple@/release/nufmt") |
| 88 | + .arg("--config") |
| 89 | + .arg(config_file.to_str().unwrap()) |
| 90 | + .arg(dir.path().to_str().unwrap()) |
| 91 | + @@ -122,7 +122,7 @@ fn files_are_checked() { |
| 92 | + fs::write(&file_a, INVALID).unwrap(); |
| 93 | + fs::write(&file_b, INVALID).unwrap(); |
| 94 | +
|
| 95 | + - let output = Command::new("target/debug/nufmt") |
| 96 | + + let output = Command::new("target/@target_triple@/release/nufmt") |
| 97 | + .arg("--config") |
| 98 | + .arg(config_file.to_str().unwrap()) |
| 99 | + .arg("--dry-run") |
| 100 | + ''; |
| 101 | + }; |
28 | 102 | in |
29 | 103 | { |
30 | 104 | devShells.default = pkgs.mkShell { |
|
41 | 115 | packages.nufmt = pkgs.rustPlatform.buildRustPackage { |
42 | 116 | name = "nufmt"; |
43 | 117 | src = ./.; |
| 118 | + patches = [ |
| 119 | + (pkgs.replaceVars "${integrationTestPatch}" { |
| 120 | + target_triple = pkgs.stdenv.hostPlatform.rust.rustcTarget; |
| 121 | + }) |
| 122 | + ]; |
44 | 123 | cargoLock.lockFile = ./Cargo.lock; |
45 | 124 | }; |
46 | 125 |
|
|
0 commit comments