-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This should help keep at least the "starting with failed modules" source of the "module defined in multiple files" bug gone.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use test_harness::fs; | ||
use test_harness::test; | ||
use test_harness::GhcidNgBuilder; | ||
|
||
/// Test that `ghcid-ng` can start with compile errors. | ||
/// | ||
/// This is a regression test for [#43](https://github.com/MercuryTechnologies/ghcid-ng/issues/43). | ||
#[test] | ||
async fn can_start_with_failed_modules() { | ||
let module_path = "src/MyModule.hs"; | ||
let mut session = GhcidNgBuilder::new("tests/data/simple") | ||
.before_start(move |path| async move { | ||
fs::replace(path.join(module_path), "example :: String", "example :: ()").await | ||
}) | ||
.start() | ||
.await | ||
.expect("ghcid-ng starts"); | ||
let module_path = session.path(module_path); | ||
|
||
session | ||
.get_log("Compilation failed") | ||
.await | ||
.expect("ghcid-ng fails to load with errors"); | ||
|
||
session.wait_until_ready().await.expect("ghcid-ng loads"); | ||
|
||
fs::replace(&module_path, "example :: ()", "example :: String") | ||
.await | ||
.unwrap(); | ||
|
||
session | ||
.get_log("Compilation succeeded") | ||
.await | ||
.expect("ghcid-ng reloads fixed modules"); | ||
} |