forked from rojo-rbx/rojo
Make the name field in projects optional (#870)
Closes #858. If a project is named `default.project.json`, it acts as an `init` file and gains the name of the folder it's inside of. If it is named something other than `default.project.json`, it gains the name of the file with `.project.json` trimmed off. So e.g. `foo.project.json` becomes `foo`.
This commit is contained in:
@@ -62,6 +62,9 @@ gen_build_tests! {
|
||||
sync_rule_alone,
|
||||
sync_rule_complex,
|
||||
sync_rule_nested_projects,
|
||||
no_name_default_project,
|
||||
no_name_project,
|
||||
no_name_top_level_project,
|
||||
}
|
||||
|
||||
fn run_build_test(test_name: &str) {
|
||||
@@ -73,7 +76,7 @@ fn run_build_test(test_name: &str) {
|
||||
let output_path = output_dir.path().join(format!("{}.rbxmx", test_name));
|
||||
|
||||
let output = Command::new(ROJO_PATH)
|
||||
.args(&[
|
||||
.args([
|
||||
"build",
|
||||
input_path.to_str().unwrap(),
|
||||
"-o",
|
||||
|
||||
@@ -306,3 +306,57 @@ fn sync_rule_no_extension() {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_name_default_project() {
|
||||
run_serve_test("no_name_default_project", |session, mut redactions| {
|
||||
let info = session.get_api_rojo().unwrap();
|
||||
let root_id = info.root_instance_id;
|
||||
|
||||
assert_yaml_snapshot!(
|
||||
"no_name_default_project_info",
|
||||
redactions.redacted_yaml(info)
|
||||
);
|
||||
|
||||
let read_response = session.get_api_read(root_id).unwrap();
|
||||
assert_yaml_snapshot!(
|
||||
"no_name_default_project_all",
|
||||
read_response.intern_and_redact(&mut redactions, root_id)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_name_project() {
|
||||
run_serve_test("no_name_project", |session, mut redactions| {
|
||||
let info = session.get_api_rojo().unwrap();
|
||||
let root_id = info.root_instance_id;
|
||||
|
||||
assert_yaml_snapshot!("no_name_project_info", redactions.redacted_yaml(info));
|
||||
|
||||
let read_response = session.get_api_read(root_id).unwrap();
|
||||
assert_yaml_snapshot!(
|
||||
"no_name_project_all",
|
||||
read_response.intern_and_redact(&mut redactions, root_id)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_name_top_level_project() {
|
||||
run_serve_test("no_name_top_level_project", |session, mut redactions| {
|
||||
let info = session.get_api_rojo().unwrap();
|
||||
let root_id = info.root_instance_id;
|
||||
|
||||
assert_yaml_snapshot!(
|
||||
"no_name_top_level_project_info",
|
||||
redactions.redacted_yaml(info)
|
||||
);
|
||||
|
||||
let read_response = session.get_api_read(root_id).unwrap();
|
||||
assert_yaml_snapshot!(
|
||||
"no_name_top_level_project_all",
|
||||
read_response.intern_and_redact(&mut redactions, root_id)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user