Add test for folder of scripts being mutated

This commit is contained in:
Lucien Greathouse
2019-10-16 16:55:55 -07:00
parent 40540c3637
commit 56f5a61362
12 changed files with 167 additions and 15 deletions

View File

@@ -22,6 +22,7 @@ pub fn run_serve_test(test_name: &str, callback: impl FnOnce(TestServeSession, R
let snapshot_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("serve-test-snapshots");
settings.set_snapshot_path(snapshot_path);
settings.set_sort_maps(true);
let mut redactions = RedactionMap::new();
@@ -34,6 +35,22 @@ pub fn run_serve_test(test_name: &str, callback: impl FnOnce(TestServeSession, R
settings.bind(move || callback(session, redactions));
}
/// Intern the response to Rojo's read API, doing traversal in a deterministic
/// order.
pub fn intern_read_response(
redactions: &mut RedactionMap,
response: &ReadResponse,
root_id: RbxId,
) {
redactions.intern(root_id);
let root_instance = response.instances.get(&root_id).unwrap();
for &child_id in root_instance.children.iter() {
intern_read_response(redactions, response, child_id);
}
}
fn get_port_number() -> usize {
static NEXT_PORT_NUMBER: AtomicUsize = AtomicUsize::new(35103);