New projects include gleeunit
@@ -12,6 +12,7 @@ use strum::{Display, EnumString, EnumVariantNames};
use crate::NewOptions;
const GLEAM_STDLIB_VERSION: &str = "0.18";
+const GLEEUNIT_VERSION: &str = "0.5";
const ERLANG_OTP_VERSION: &str = "23.2";
#[derive(Debug, Serialize, Deserialize, Display, EnumString, EnumVariantNames, Clone, Copy)]
@@ -182,10 +183,11 @@ version = "0.1.0"
gleam_stdlib = "~> {gleam_stdlib}"
[dev-dependencies]
-# some_test_package = "~> 1.0"
+gleeunit = "~> {gleeunit}"
"#,
name = self.project_name,
gleam_stdlib = GLEAM_STDLIB_VERSION,
+ gleeunit = GLEEUNIT_VERSION,
),
)
}
@@ -193,10 +195,17 @@ gleam_stdlib = "~> {gleam_stdlib}"
fn test_module(&self) -> Result<()> {
write(
self.test.join(format!("{}_test.gleam", self.project_name)),
- r#"import gleam/io
+ r#"import gleeunit
+import gleeunit/should
pub fn main() {
- io.println("TODO: Write some tests")
+ gleeunit.main()
+}
+
+// gleeunit test functions end in `_test`
+pub fn hello_world_test() {
+ 1
+ |> should.equal(1)
}
"#,
)
