First round of snapshot tests for patch_compute

This commit is contained in:
Lucien Greathouse
2019-09-30 17:00:12 -07:00
parent 3678ddfa36
commit b512e707a5
9 changed files with 128 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
use std::collections::HashMap;
use rbx_dom_weak::{RbxId, RbxValue};
use serde::{Deserialize, Serialize};
use super::{InstanceMetadata, InstanceSnapshot};
@@ -11,7 +12,7 @@ use super::{InstanceMetadata, InstanceSnapshot};
/// These patches shouldn't be persisted: there's no mechanism in place to make
/// sure that another patch wasn't applied before this one that could cause a
/// conflict!
#[derive(Debug, Default, Clone, PartialEq)]
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
pub struct PatchSet<'a> {
pub removed_instances: Vec<RbxId>,
pub added_instances: Vec<PatchAdd<'a>>,
@@ -29,14 +30,14 @@ impl<'a> PatchSet<'a> {
}
/// A patch containing an instance that was added to the tree.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PatchAdd<'a> {
pub parent_id: RbxId,
pub instance: InstanceSnapshot<'a>,
}
/// A patch indicating that properties of an instance changed.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PatchUpdate {
pub id: RbxId,
pub changed_name: Option<String>,