diff options
author | Andrew Prokhorenkov <andrew.prokhorenkov@gmail.com> | 2020-02-06 11:11:20 -0600 |
---|---|---|
committer | Matan Kushner <hello@matchai.dev> | 2020-02-06 12:12:07 -0500 |
commit | cead23edcaa7de0b5bcfb22d96f226628c4bbecd (patch) | |
tree | 140d3714f0d575bd96bf8a4d9286de7d497e4fd4 /tests | |
parent | c4ab66d7fe1fe4993a1b3e701ffb779eca51bcd3 (diff) |
test: port Haskell module tests to integration test (#913)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testsuite/haskell.rs | 71 | ||||
-rw-r--r-- | tests/testsuite/main.rs | 1 |
2 files changed, 0 insertions, 72 deletions
diff --git a/tests/testsuite/haskell.rs b/tests/testsuite/haskell.rs deleted file mode 100644 index 11e90238c..000000000 --- a/tests/testsuite/haskell.rs +++ /dev/null @@ -1,71 +0,0 @@ -use ansi_term::Color; -use dirs::home_dir; -use std::fs::{File, OpenOptions}; -use std::io::{self, Write}; -use tempfile::{self, TempDir}; - -use crate::common; - -#[test] -fn folder_without_stack_yaml() -> io::Result<()> { - let dir = tempfile::tempdir()?; - - let output = common::render_module("haskell") - .arg("--path") - .arg(dir.path()) - .output()?; - let actual = String::from_utf8(output.stdout).unwrap(); - - let expected = ""; - assert_eq!(expected, actual); - Ok(()) -} - -#[test] -#[ignore] -#[cfg(not(windows))] -fn folder_with_stack_yaml() -> io::Result<()> { - let dir = tempfile::tempdir()?; - create_dummy_haskell_project(&dir, Some("nightly-2019-09-21 # Last GHC 8.6.5"))?; - - let output = if cfg!(windows) { - let mut app_data = home_dir().unwrap(); - app_data.push("AppData"); - app_data.push("Local"); - eprintln!("{}", app_data.to_str().unwrap()); - common::render_module("haskell") - .env("HOME", home_dir().unwrap()) - .env("LOCALAPPDATA", app_data) - .env("STACK_ROOT", r"C:\sr") - .arg("--path") - .arg(dir.path()) - .output()? - } else { - common::render_module("haskell") - .env("HOME", home_dir().unwrap()) - .arg("--path") - .arg(dir.path()) - .output()? - }; - - let actual = String::from_utf8(output.stdout).unwrap(); - - let expected = format!("via {} ", Color::Red.bold().paint("λ v8.6.5")); - assert_eq!(expected, actual); - Ok(()) -} - -fn create_dummy_haskell_project(folder: &TempDir, contents: Option<&str>) -> io::Result<()> { - let cabal_path = folder.path().join("test.cabal"); - File::create(cabal_path)?.sync_all()?; - - let stack_yaml_path = folder.path().join("stack.yaml"); - - let mut stack_yaml_file = OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(&stack_yaml_path)?; - write!(stack_yaml_file, "resolver: {}", contents.unwrap_or(""))?; - stack_yaml_file.sync_data() -} diff --git a/tests/testsuite/main.rs b/tests/testsuite/main.rs index f12b60780..8da64b56f 100644 --- a/tests/testsuite/main.rs +++ b/tests/testsuite/main.rs @@ -12,7 +12,6 @@ mod git_commit; mod git_state; mod git_status; mod golang; -mod haskell; mod hg_branch; mod hostname; mod jobs; |