mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 14:15:24 +00:00
Unlike most of the other backports, this code couldn't be directly translated so it had to be re-implemented. Luckily, it is very simple. This implementation is a bit messy and heavy handed with potential panics, but I think it's probably fine since file names that aren't UTF-8 aren't really supported anyway. The original implementation is a lot cleaner though. The test snapshots are (almost) all identical between the 7.5 implementation and this one. The sole exception is with the path in the `snapshot_middleware::project` test, since I didn't feel like adding a `name` parameter to `snapshot_project` in this implementation.
This commit is contained in:
@@ -59,6 +59,9 @@ gen_build_tests! {
|
||||
txt_in_folder,
|
||||
unresolved_values,
|
||||
weldconstraint,
|
||||
no_name_default_project,
|
||||
no_name_project,
|
||||
no_name_top_level_project,
|
||||
}
|
||||
|
||||
fn run_build_test(test_name: &str) {
|
||||
@@ -70,7 +73,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",
|
||||
|
||||
@@ -255,3 +255,57 @@ fn add_optional_folder() {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[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