update default template tag

This commit is contained in:
Michael Angelo Calimlim 2023-11-05 21:51:11 +08:00
parent c957170cea
commit 59f5fcd5ea
3 changed files with 92 additions and 6 deletions

View file

@ -482,6 +482,7 @@ mod ftw_command_tests {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -496,6 +497,7 @@ mod ftw_command_tests {
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(".gitignore").contains(".tag")); assert!(project.read(".gitignore").contains(".tag"));
assert!(project.read(".tag").contains("v1.5.0"));
assert!(project assert!(project
.read("rust/Cargo.toml") .read("rust/Cargo.toml")
.contains(&project.get_name())); .contains(&project.get_name()));
@ -513,6 +515,7 @@ mod ftw_command_tests {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -527,7 +530,42 @@ mod ftw_command_tests {
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(".gitignore").contains(".tag")); assert!(project.read(".gitignore").contains(".tag"));
assert!(project.read(".tag").contains("v1.4.0")); assert!(project.read(".tag").contains("v1.5.0"));
assert!(project
.read("rust/Cargo.toml")
.contains(&project.get_name()));
}
#[test]
fn test_process_ftw_command_new_with_v150_tag() {
let project = Project::new();
let cmd = FtwCommand::New {
project_name: project.get_name(),
template: FtwTemplate::default(),
tag: FtwTag::Tagged {
git_tag: String::from("v1.5.0"),
},
};
let _ = cmd.process();
assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
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(".gitignore").contains(".tag"));
assert!(project.read(".tag").contains("v1.5.0"));
assert!(project assert!(project
.read("rust/Cargo.toml") .read("rust/Cargo.toml")
.contains(&project.get_name())); .contains(&project.get_name()));
@ -547,6 +585,7 @@ mod ftw_command_tests {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -581,6 +620,7 @@ mod ftw_command_tests {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -615,6 +655,7 @@ mod ftw_command_tests {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -1046,6 +1087,11 @@ enable-cross-compilation=true
"bin/{target_cli_arg}/{project_name}.debug.{target_cli_arg}.pck" "bin/{target_cli_arg}/{project_name}.debug.{target_cli_arg}.pck"
))); )));
} }
if target.is_windows() {
assert!(project.exists(&format!(
"bin/{target_cli_arg}/{project_name}.debug.{target_cli_arg}.pck"
)));
}
if target.is_ios() { if target.is_ios() {
assert!(project.exists(&format!( assert!(project.exists(&format!(
"bin/{target_cli_arg}/{project_name}.debug.{target_cli_arg}.pck" "bin/{target_cli_arg}/{project_name}.debug.{target_cli_arg}.pck"

View file

@ -11,7 +11,7 @@ pub enum FtwTag {
Tagged { git_tag: GitTag }, Tagged { git_tag: GitTag },
} }
const DEFAULT_TEMPLATE_TAG: &str = "v1.4.0"; const DEFAULT_TEMPLATE_TAG: &str = "v1.5.0";
impl FromStr for FtwTag { impl FromStr for FtwTag {
type Err = (); type Err = ();
@ -69,7 +69,7 @@ mod ftw_tag_tests {
#[test] #[test]
fn test_to_git_tag() { fn test_to_git_tag() {
assert_eq!(FtwTag::Latest.to_git_tag(), "v1.4.0"); assert_eq!(FtwTag::Latest.to_git_tag(), "v1.5.0");
assert_eq!( assert_eq!(
FtwTag::Tagged { FtwTag::Tagged {
git_tag: String::from("v1.1.0") git_tag: String::from("v1.1.0")
@ -84,7 +84,7 @@ mod ftw_tag_tests {
let latest = FtwTag::Latest; let latest = FtwTag::Latest;
let git_tag = String::from("v1.1.0"); let git_tag = String::from("v1.1.0");
let tagged = FtwTag::Tagged { git_tag }; let tagged = FtwTag::Tagged { git_tag };
assert_eq!(format!("{latest}"), "v1.4.0"); assert_eq!(format!("{latest}"), "v1.5.0");
assert_eq!(format!("{tagged}"), "v1.1.0"); assert_eq!(format!("{tagged}"), "v1.1.0");
} }

View file

@ -19,6 +19,7 @@ fn test_ftw_new() {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -32,7 +33,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.read(".tag").contains("v1.5.0"));
assert!(project assert!(project
.read("rust/Cargo.toml") .read("rust/Cargo.toml")
.contains(&project.get_name())); .contains(&project.get_name()));
@ -52,6 +53,7 @@ fn test_ftw_new_with_latest_tag() {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -65,7 +67,41 @@ 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(".tag").contains("v1.5.0"));
assert!(project
.read("rust/Cargo.toml")
.contains(&project.get_name()));
}
#[test]
fn test_ftw_new_with_v150_tag() {
let project = Project::new();
ftw()
.arg("new")
.arg(&project.get_name())
.arg("default")
.arg("v1.5.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("Makefile.toml"));
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.5.0"));
assert!(project assert!(project
.read("rust/Cargo.toml") .read("rust/Cargo.toml")
.contains(&project.get_name())); .contains(&project.get_name()));
@ -85,6 +121,7 @@ fn test_ftw_new_with_v140_tag() {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -118,6 +155,7 @@ fn test_ftw_new_with_v130_tag() {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -151,6 +189,7 @@ fn test_ftw_new_with_v120_tag() {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));
@ -182,6 +221,7 @@ fn test_ftw_new_no_template() {
assert!(project.exists(".gitignore")); assert!(project.exists(".gitignore"));
assert!(project.exists("Cargo.toml")); assert!(project.exists("Cargo.toml"));
assert!(project.exists("Makefile")); assert!(project.exists("Makefile"));
assert!(project.exists("Makefile.toml"));
assert!(project.exists("godot/default_env.tres")); assert!(project.exists("godot/default_env.tres"));
assert!(project.exists("godot/export_presets.cfg")); assert!(project.exists("godot/export_presets.cfg"));
assert!(project.exists("godot/native/game.gdnlib")); assert!(project.exists("godot/native/game.gdnlib"));