aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/1/a.f9011
-rw-r--r--tests/1/b.f9010
-rw-r--r--tests/1/fpm.toml2
-rw-r--r--tests/1/main.f908
-rw-r--r--tests/2/fpm.toml2
-rw-r--r--tests/2/main.f905
-rw-r--r--tests/cli.rs103
7 files changed, 0 insertions, 141 deletions
diff --git a/tests/1/a.f90 b/tests/1/a.f90
deleted file mode 100644
index a4f64a2..0000000
--- a/tests/1/a.f90
+++ /dev/null
@@ -1,11 +0,0 @@
-module a
-use b, only: g
-implicit none
-
-contains
-
- subroutine f()
- call g()
- end subroutine
-
-end module
diff --git a/tests/1/b.f90 b/tests/1/b.f90
deleted file mode 100644
index 8b57633..0000000
--- a/tests/1/b.f90
+++ /dev/null
@@ -1,10 +0,0 @@
-module b
-implicit none
-
-contains
-
- subroutine g()
- print *, "g()"
- end subroutine
-
-end module
diff --git a/tests/1/fpm.toml b/tests/1/fpm.toml
deleted file mode 100644
index c7d48a4..0000000
--- a/tests/1/fpm.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-[dependencies]
-a = "4.0.0"
diff --git a/tests/1/main.f90 b/tests/1/main.f90
deleted file mode 100644
index d886be3..0000000
--- a/tests/1/main.f90
+++ /dev/null
@@ -1,8 +0,0 @@
-program test1
-use a, only: f
-implicit none
-
-call f()
-
-print *, "TEST1 OK"
-end
diff --git a/tests/2/fpm.toml b/tests/2/fpm.toml
deleted file mode 100644
index c7d48a4..0000000
--- a/tests/2/fpm.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-[dependencies]
-a = "4.0.0"
diff --git a/tests/2/main.f90 b/tests/2/main.f90
deleted file mode 100644
index bd820eb..0000000
--- a/tests/2/main.f90
+++ /dev/null
@@ -1,5 +0,0 @@
-program test2
-implicit none
-
-print *, "TEST2 OK"
-end
diff --git a/tests/cli.rs b/tests/cli.rs
deleted file mode 100644
index b099721..0000000
--- a/tests/cli.rs
+++ /dev/null
@@ -1,103 +0,0 @@
-use assert_cmd::prelude::OutputAssertExt; // Add methods on commands
-use predicates::prelude::{predicate, PredicateBooleanExt}; // Used for writing assertions
-#[cfg(unix)]
-use std::os::unix::process::ExitStatusExt;
-
-pub trait Success2 {
- // Our own function with better reporting of errors
- fn success2(self) -> Self;
-}
-
-#[cfg(unix)]
-fn get_signal(status: std::process::ExitStatus) -> Option<i32> {
- status.signal()
-}
-
-#[cfg(not(unix))]
-fn get_signal(_status: std::process::ExitStatus) -> Option<i32> {
- None
-}
-
-impl Success2 for assert_cmd::assert::Assert {
- fn success2(self) -> Self {
- if !self.get_output().status.success() {
- let output = self.get_output();
- let code = output.status.code();
- println!("status: {}", output.status);
- println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
- println!("stderr: {}", String::from_utf8_lossy(&output.stderr));
- if cfg!(unix) {
- if code.is_none() {
- let signal = get_signal(output.status).unwrap();
- panic!("INTERRUPTED with signal: {}", signal);
- }
- }
- let actual_code = code.unwrap();
- println!("code: {}", actual_code);
- panic!("Non zero exit code");
- }
- self
- }
-}
-
-fn fpm_bin() -> std::process::Command {
- let mut fpm_bin_relative: std::path::PathBuf = ["target", "debug", "fpm"].iter().collect();
- fpm_bin_relative.set_extension(std::env::consts::EXE_EXTENSION);
- let fpm_bin_absolute = std::fs::canonicalize(fpm_bin_relative).unwrap();
- std::process::Command::new(fpm_bin_absolute.to_str().unwrap())
-}
-
-#[test]
-fn test_help() {
- let mut cmd = fpm_bin();
- cmd.arg("--help");
- cmd.assert()
- .success2()
- .stdout(
- predicate::str::contains("--help Prints help information"));
-}
-
-
-#[test]
-fn test_1() {
- let mut build = fpm_bin();
- build.arg("build")
- .arg("--target-dir")
- .arg("build-test")
- .current_dir("tests/1");
- build.assert()
- .success2()
- .stdout(predicate::str::contains("Built target p1")
- .and(predicate::str::contains("TEST1 OK").not()));
-
- let mut run = fpm_bin();
- run.arg("run")
- .arg("--target-dir")
- .arg("build-test")
- .current_dir("tests/1");
- run.assert()
- .success2()
- .stdout(predicate::str::contains("TEST1 OK"));
-}
-
-#[test]
-fn test_2() {
- let mut build = fpm_bin();
- build.arg("build")
- .arg("--target-dir")
- .arg("build-test")
- .current_dir("tests/2");
- build.assert()
- .success2()
- .stdout(predicate::str::contains("Built target p1")
- .and(predicate::str::contains("TEST2 OK").not()));
-
- let mut run = fpm_bin();
- run.arg("run")
- .arg("--target-dir")
- .arg("build-test")
- .current_dir("tests/2");
- run.assert()
- .success2()
- .stdout(predicate::str::contains("TEST2 OK"));
-}