mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 06:05:24 +00:00
Add RunContext support for script outputs (#765)
Resolves #667 This PR: - Introduces a new field in the project file: `scriptType` which has the default value of `Class` (in parity with previous versions), but can also be `RunContext`. - This is then passed to `InstanceContext` from the `Project` struct. - This then changes the RunContext in the lua `snapshot_middleware` --------- Co-authored-by: Micah <dekkonot@rocketmail.com>
This commit is contained in:
@@ -44,6 +44,7 @@ gen_build_tests! {
|
||||
json_model_legacy_name,
|
||||
module_in_folder,
|
||||
module_init,
|
||||
nested_runcontext,
|
||||
optional,
|
||||
project_composed_default,
|
||||
project_composed_file,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::fs;
|
||||
|
||||
use insta::assert_yaml_snapshot;
|
||||
use insta::{assert_yaml_snapshot, with_settings};
|
||||
use tempfile::tempdir;
|
||||
|
||||
use crate::rojo_test::{internable::InternAndRedact, serve_util::run_serve_test};
|
||||
@@ -30,10 +30,12 @@ fn scripts() {
|
||||
assert_yaml_snapshot!("scripts_info", redactions.redacted_yaml(info));
|
||||
|
||||
let read_response = session.get_api_read(root_id).unwrap();
|
||||
assert_yaml_snapshot!(
|
||||
"scripts_all",
|
||||
read_response.intern_and_redact(&mut redactions, root_id)
|
||||
);
|
||||
with_settings!({ sort_maps => true }, {
|
||||
assert_yaml_snapshot!(
|
||||
"scripts_all",
|
||||
read_response.intern_and_redact(&mut redactions, root_id)
|
||||
);
|
||||
});
|
||||
|
||||
fs::write(session.path().join("src/foo.lua"), "Updated foo!").unwrap();
|
||||
|
||||
@@ -44,10 +46,12 @@ fn scripts() {
|
||||
);
|
||||
|
||||
let read_response = session.get_api_read(root_id).unwrap();
|
||||
assert_yaml_snapshot!(
|
||||
"scripts_all-2",
|
||||
read_response.intern_and_redact(&mut redactions, root_id)
|
||||
);
|
||||
with_settings!({ sort_maps => true }, {
|
||||
assert_yaml_snapshot!(
|
||||
"scripts_all-2",
|
||||
read_response.intern_and_redact(&mut redactions, root_id)
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user