fix tests

This commit is contained in:
Michael Angelo Calimlim 2023-11-02 13:35:52 +08:00
parent 5b03c35e4c
commit 995c538e82
2 changed files with 70 additions and 2 deletions

View file

@ -529,6 +529,74 @@ mod ftw_command_tests {
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.4.0"));
assert!(project
.read("rust/Cargo.toml")
.contains(&project.get_name()));
}
#[test]
fn test_process_ftw_command_new_with_v140_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.4.0"),
},
};
let _ = cmd.process();
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(".gitignore").contains(".tag"));
assert!(project.read(".tag").contains("v1.4.0"));
assert!(project
.read("rust/Cargo.toml")
.contains(&project.get_name()));
}
#[test]
fn test_process_ftw_command_new_with_v130_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.3.0"),
},
};
let _ = cmd.process();
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(".gitignore").contains(".tag"));
assert!(project.read(".tag").contains("v1.3.0"));
assert!(project
.read("rust/Cargo.toml")

View file

@ -69,7 +69,7 @@ mod ftw_tag_tests {
#[test]
fn test_to_git_tag() {
assert_eq!(FtwTag::Latest.to_git_tag(), "v1.3.0");
assert_eq!(FtwTag::Latest.to_git_tag(), "v1.4.0");
assert_eq!(
FtwTag::Tagged {
git_tag: String::from("v1.1.0")
@ -84,7 +84,7 @@ mod ftw_tag_tests {
let latest = FtwTag::Latest;
let git_tag = String::from("v1.1.0");
let tagged = FtwTag::Tagged { git_tag };
assert_eq!(format!("{latest}"), "v1.3.0");
assert_eq!(format!("{latest}"), "v1.4.0");
assert_eq!(format!("{tagged}"), "v1.1.0");
}