tools.vcreate: rework cli arg handling to extend scaffolding and fix issues (#19889)

This commit is contained in:
Turiiya 2023-11-16 14:40:23 +01:00 committed by GitHub
parent 9308bcd48a
commit e9258c2a08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 237 additions and 139 deletions

View file

@ -68,12 +68,13 @@ fn test_new_with_name_arg_input() {
fn test_new_with_model_arg_input() {
prepare_test_path()!
project_name := 'my_lib'
model := 'lib'
os.execute_opt('${expect_exe} ${os.join_path(expect_tests_path, 'new_with_model_arg.expect')} ${vroot} ${project_name} ${model}') or {
model := '--lib'
os.execute_opt('${expect_exe} ${os.join_path(expect_tests_path, 'new_with_model_arg.expect')} ${vroot} ${model} ${project_name}') or {
assert false, err.msg()
}
project_path := os.join_path(test_module_path, project_name)
// Assert mod data set in `new_with_model_arg.expect`.
mod := vmod.from_file(os.join_path(test_module_path, project_name, 'v.mod')) or {
mod := vmod.from_file(os.join_path(project_path, 'v.mod')) or {
assert false, err.str()
return
}
@ -81,4 +82,6 @@ fn test_new_with_model_arg_input() {
assert mod.description == 'My Awesome V Project.'
assert mod.version == '0.0.1'
assert mod.license == 'MIT'
// Assert existence of a model-specific file.
assert os.exists(os.join_path(project_path, 'tests', 'square_test.v'))
}