diff --git a/rojo-test/serve-test-snapshots/serve_test__edit_init_all-2.snap b/rojo-test/serve-test-snapshots/serve_test__edit_init_all-2.snap new file mode 100644 index 00000000..d11fbb4b --- /dev/null +++ b/rojo-test/serve-test-snapshots/serve_test__edit_init_all-2.snap @@ -0,0 +1,19 @@ +--- +source: rojo-test/src/serve_test.rs +expression: "read_response.intern_and_redact(&mut redactions, root_id)" +--- +instances: + id-2: + Children: [] + ClassName: ModuleScript + Id: id-2 + Metadata: + ignoreUnknownInstances: false + Name: edit_init + Parent: ~ + Properties: + Source: + Type: String + Value: "-- Edited contents" +messageCursor: 1 +sessionId: id-1 diff --git a/rojo-test/serve-test-snapshots/serve_test__edit_init_all.snap b/rojo-test/serve-test-snapshots/serve_test__edit_init_all.snap new file mode 100644 index 00000000..9596f3a8 --- /dev/null +++ b/rojo-test/serve-test-snapshots/serve_test__edit_init_all.snap @@ -0,0 +1,19 @@ +--- +source: rojo-test/src/serve_test.rs +expression: "read_response.intern_and_redact(&mut redactions, root_id)" +--- +instances: + id-2: + Children: [] + ClassName: ModuleScript + Id: id-2 + Metadata: + ignoreUnknownInstances: false + Name: edit_init + Parent: ~ + Properties: + Source: + Type: String + Value: "-- Original contents" +messageCursor: 0 +sessionId: id-1 diff --git a/rojo-test/serve-test-snapshots/serve_test__edit_init_info.snap b/rojo-test/serve-test-snapshots/serve_test__edit_init_info.snap new file mode 100644 index 00000000..f826d7e7 --- /dev/null +++ b/rojo-test/serve-test-snapshots/serve_test__edit_init_info.snap @@ -0,0 +1,9 @@ +--- +source: rojo-test/src/serve_test.rs +expression: redactions.redacted_yaml(info) +--- +expectedPlaceIds: ~ +protocolVersion: 3 +rootInstanceId: id-2 +serverVersion: 0.6.0-dev +sessionId: id-1 diff --git a/rojo-test/serve-test-snapshots/serve_test__edit_init_subscribe.snap b/rojo-test/serve-test-snapshots/serve_test__edit_init_subscribe.snap new file mode 100644 index 00000000..ef6a4fc8 --- /dev/null +++ b/rojo-test/serve-test-snapshots/serve_test__edit_init_subscribe.snap @@ -0,0 +1,18 @@ +--- +source: rojo-test/src/serve_test.rs +expression: "subscribe_response.intern_and_redact(&mut redactions, ())" +--- +messageCursor: 1 +messages: + - added: {} + removed: [] + updated: + - changedClassName: ~ + changedMetadata: ~ + changedName: ~ + changedProperties: + Source: + Type: String + Value: "-- Edited contents" + id: id-2 +sessionId: id-1 diff --git a/rojo-test/src/serve_test.rs b/rojo-test/src/serve_test.rs index 4377a982..80ecae77 100644 --- a/rojo-test/src/serve_test.rs +++ b/rojo-test/src/serve_test.rs @@ -132,9 +132,6 @@ fn remove_file() { } #[test] -// Editing an init file currently crashes the ChangeProcessor thread. -// https://github.com/rojo-rbx/rojo/issues/267 -#[ignore] fn edit_init() { run_serve_test("edit_init", |session, mut redactions| { let info = session.get_api_rojo().unwrap(); @@ -148,7 +145,7 @@ fn edit_init() { read_response.intern_and_redact(&mut redactions, root_id) ); - fs::write(session.path().join("init.lua"), b"-- Edited contents.").unwrap(); + fs::write(session.path().join("init.lua"), b"-- Edited contents").unwrap(); let subscribe_response = session.get_api_subscribe(0).unwrap(); assert_yaml_snapshot!( diff --git a/src/snapshot_middleware/lua.rs b/src/snapshot_middleware/lua.rs index cba22156..abeb5773 100644 --- a/src/snapshot_middleware/lua.rs +++ b/src/snapshot_middleware/lua.rs @@ -138,7 +138,7 @@ fn snapshot_init( init_snapshot.name = dir_snapshot.name; init_snapshot.children = dir_snapshot.children; - // TODO: Apply metadata from folder + init_snapshot.metadata = dir_snapshot.metadata; return Ok(Some(init_snapshot)); }