add rust test and run tests from main

This commit is contained in:
Peter Tillemans 2023-11-27 18:49:09 +01:00
parent a6cf224826
commit 3dbcb8176c
8 changed files with 31 additions and 23 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
__pycache__
*.lock

View file

@ -1,10 +0,0 @@
(ns testoperenv.main
(:require [medley.core :as m]
[babashka.process :as p]
))
(defn -main []
(println "Hello, World!")
(:out (p/shell {:out :string :err :string} "bash" "-c" "echo -n foobar")))

View file

@ -1 +0,0 @@
pti@mars.124815:1695820260

View file

@ -1,10 +1,9 @@
(ns testoperenv.main (ns testoperenv.main
(:require [medley.core :as m] (:require [clojure.test :refer [run-tests]]
[babashka.process :as p] [testoperenv.test-languages]))
))
(defn -main [] (defn -main []
(println "Hello, World!") (println "Testing the operating environment")
(:out (p/shell {:out :string :err :string} "bash" "-c" "echo -n foobar"))) (run-tests 'testoperenv.test-languages))

View file

@ -0,0 +1,14 @@
(ns testoperenv.test-languages
(:require [clojure.test :refer [deftest is testing]]
[clojure.string :as str]
[testoperenv.cmd :refer [run-cmd-in-dir]]))
(deftest test-python
(testing "python tooling is installed"
(is (str/includes? (run-cmd-in-dir "python" "poetry" "run" "pytest" "smoketest.py") "[100%]"))))
(deftest test-rust
(testing "rust tooling is installed"
(is (str/includes? (run-cmd-in-dir "rust" "cargo" "run") "Rust is awesome"))))

View file

@ -1,7 +0,0 @@
(ns testoperenv.test-python
(:require [clojure.test :refer [deftest is testing]]))
(deftest test-python
(testing "python is installed"
(is (= "foobar" (run-cmd-in-dir "python" "poetry" "pytest" "smoketest.py"))))))

8
rust/Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "rust"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

3
rust/src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Rust is awesome!");
}