瀏覽代碼

Add integration tests for new info command

Andrew Chin 1 年之前
父節點
當前提交
c54fbc9077
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      numbat-cli/tests/integration.rs

+ 13 - 0
numbat-cli/tests/integration.rs

@@ -1,6 +1,7 @@
 use std::path::Path;
 
 use assert_cmd::Command;
+use predicates::boolean::PredicateBooleanExt;
 
 fn numbat() -> Command {
     let module_path = Path::new(&std::env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("modules");
@@ -125,3 +126,15 @@ fn help_text() {
             "Energy of red photons: 1.87855 eV",
         ));
 }
+
+#[test]
+fn info_text() {
+    numbat().write_stdin("info g0").assert().success().stdout(
+        predicates::str::contains("Standard acceleration of gravity on earth")
+            .and(predicates::str::contains("9.80665 m/s²")),
+    );
+
+    numbat().write_stdin("info C").assert().success().stdout(
+        predicates::str::contains("Coulomb").and(predicates::str::contains("1 coulomb = ")),
+    );
+}