add more tests for template tag

This commit is contained in:
Michael Angelo Calimlim 2023-11-02 13:07:25 +08:00
parent 9dcc025c1b
commit e111ea10fc

View file

@ -32,6 +32,7 @@ fn test_ftw_new() {
assert!(project.read(".gitignore").contains("bin/*")); assert!(project.read(".gitignore").contains("bin/*"));
assert!(project.read(".gitignore").contains("export_presets.cfg")); assert!(project.read(".gitignore").contains("export_presets.cfg"));
assert!(project.read(".gitignore").contains("lib/*")); assert!(project.read(".gitignore").contains("lib/*"));
assert!(project.read(".tag").contains("v1.4.0"));
assert!(project assert!(project
.read("rust/Cargo.toml") .read("rust/Cargo.toml")
.contains(&project.get_name())); .contains(&project.get_name()));
@ -64,6 +65,72 @@ fn test_ftw_new_with_latest_tag() {
assert!(project.read(".gitignore").contains("bin/*")); assert!(project.read(".gitignore").contains("bin/*"));
assert!(project.read(".gitignore").contains("export_presets.cfg")); assert!(project.read(".gitignore").contains("export_presets.cfg"));
assert!(project.read(".gitignore").contains("lib/*")); assert!(project.read(".gitignore").contains("lib/*"));
assert!(project.read(".tag").contains("v1.4.0"));
assert!(project
.read("rust/Cargo.toml")
.contains(&project.get_name()));
}
#[test]
fn test_ftw_new_with_v140_tag() {
let project = Project::new();
ftw()
.arg("new")
.arg(&project.get_name())
.arg("default")
.arg("v1.4.0")
.assert()
.success()
.stdout(predicates::str::contains("SUCCESS").from_utf8());
assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile"));
assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib"));
assert!(project.exists("godot/project.godot"));
assert!(project.exists("rust/Cargo.toml"));
assert!(project.exists("rust/src/lib.rs"));
assert!(!project.exists("LICENSE"));
assert!(!project.exists(".travis.yml"));
assert!(!project.exists("sh"));
assert!(project.read(".gitignore").contains(".ftw"));
assert!(project.read(".gitignore").contains("bin/*"));
assert!(project.read(".gitignore").contains("export_presets.cfg"));
assert!(project.read(".gitignore").contains("lib/*"));
assert!(project.read(".tag").contains("v1.4.0"));
assert!(project
.read("rust/Cargo.toml")
.contains(&project.get_name()));
}
#[test]
fn test_ftw_new_with_v130_tag() {
let project = Project::new();
ftw()
.arg("new")
.arg(&project.get_name())
.arg("default")
.arg("v1.3.0")
.assert()
.success()
.stdout(predicates::str::contains("SUCCESS").from_utf8());
assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile"));
assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib"));
assert!(project.exists("godot/project.godot"));
assert!(project.exists("rust/Cargo.toml"));
assert!(project.exists("rust/src/lib.rs"));
assert!(!project.exists("LICENSE"));
assert!(!project.exists(".travis.yml"));
assert!(!project.exists("sh"));
assert!(project.read(".gitignore").contains(".ftw"));
assert!(project.read(".gitignore").contains("bin/*"));
assert!(project.read(".gitignore").contains("export_presets.cfg"));
assert!(project.read(".gitignore").contains("lib/*"));
assert!(project.read(".tag").contains("v1.3.0")); assert!(project.read(".tag").contains("v1.3.0"));
assert!(project assert!(project
.read("rust/Cargo.toml") .read("rust/Cargo.toml")