mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 12:01:38 +00:00
Merge branch 'master' into headless-api
This commit is contained in:
commit
cb451c8d21
24 changed files with 89 additions and 84 deletions
4
build.rs
4
build.rs
|
|
@ -20,6 +20,10 @@ fn snapshot_from_fs_path(path: &Path) -> io::Result<VfsSnapshot> {
|
||||||
|
|
||||||
let file_name = entry.file_name().to_str().unwrap().to_owned();
|
let file_name = entry.file_name().to_str().unwrap().to_owned();
|
||||||
|
|
||||||
|
if file_name.starts_with(".git") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// We can skip any TestEZ test files since they aren't necessary for
|
// We can skip any TestEZ test files since they aren't necessary for
|
||||||
// the plugin to run.
|
// the plugin to run.
|
||||||
if file_name.ends_with(".spec.lua") || file_name.ends_with(".spec.luau") {
|
if file_name.ends_with(".spec.lua") || file_name.ends_with(".spec.luau") {
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,13 @@ use serde::Serialize;
|
||||||
/// Enables redacting any value that serializes as a string.
|
/// Enables redacting any value that serializes as a string.
|
||||||
///
|
///
|
||||||
/// Used for transforming Rojo instance IDs into something deterministic.
|
/// Used for transforming Rojo instance IDs into something deterministic.
|
||||||
|
#[derive(Default)]
|
||||||
pub struct RedactionMap {
|
pub struct RedactionMap {
|
||||||
ids: HashMap<String, usize>,
|
ids: HashMap<String, usize>,
|
||||||
last_id: usize,
|
last_id: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RedactionMap {
|
impl RedactionMap {
|
||||||
pub fn new() -> Self {
|
|
||||||
Self {
|
|
||||||
ids: HashMap::new(),
|
|
||||||
last_id: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_redacted_value(&self, id: impl ToString) -> Option<String> {
|
pub fn get_redacted_value(&self, id: impl ToString) -> Option<String> {
|
||||||
let id = id.to_string();
|
let id = id.to_string();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,9 @@ function Checkbox:render()
|
||||||
end,
|
end,
|
||||||
}, {
|
}, {
|
||||||
StateTip = e(Tooltip.Trigger, {
|
StateTip = e(Tooltip.Trigger, {
|
||||||
text = (if self.props.locked then "[LOCKED] " else "")
|
text = (if self.props.locked
|
||||||
.. (if self.props.active then "Enabled" else "Disabled"),
|
then (self.props.lockedTooltip or "(Cannot be changed right now)") .. "\n"
|
||||||
|
else "") .. (if self.props.active then "Enabled" else "Disabled"),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Active = e(SlicedImage, {
|
Active = e(SlicedImage, {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ local getTextBoundsAsync = require(Plugin.App.getTextBoundsAsync)
|
||||||
|
|
||||||
local SlicedImage = require(script.Parent.SlicedImage)
|
local SlicedImage = require(script.Parent.SlicedImage)
|
||||||
local ScrollingFrame = require(script.Parent.ScrollingFrame)
|
local ScrollingFrame = require(script.Parent.ScrollingFrame)
|
||||||
|
local Tooltip = require(script.Parent.Tooltip)
|
||||||
|
|
||||||
local e = Roact.createElement
|
local e = Roact.createElement
|
||||||
|
|
||||||
|
|
@ -119,6 +120,12 @@ function Dropdown:render()
|
||||||
end),
|
end),
|
||||||
|
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
|
}, {
|
||||||
|
StateTip = if self.props.locked
|
||||||
|
then e(Tooltip.Trigger, {
|
||||||
|
text = self.props.lockedTooltip or "(Cannot be changed right now)",
|
||||||
|
})
|
||||||
|
else nil,
|
||||||
}),
|
}),
|
||||||
Active = e("TextLabel", {
|
Active = e("TextLabel", {
|
||||||
Size = UDim2.new(1, -30, 1, 0),
|
Size = UDim2.new(1, -30, 1, 0),
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,8 @@ local TooltipContext = Roact.createContext({})
|
||||||
|
|
||||||
local function Popup(props)
|
local function Popup(props)
|
||||||
return Theme.with(function(theme)
|
return Theme.with(function(theme)
|
||||||
local textXSpace = math.min(props.parentSize.X, 120)
|
local textXSpace = math.min(props.parentSize.X, 250) - TEXT_PADDING.X
|
||||||
local textBounds = Vector2.new(
|
local textBounds = getTextBoundsAsync(props.Text, theme.Font.Main, theme.TextSize.Medium, textXSpace)
|
||||||
textXSpace,
|
|
||||||
getTextBoundsAsync(props.Text, theme.Font.Main, theme.TextSize.Medium, textXSpace).Y
|
|
||||||
)
|
|
||||||
local contentSize = textBounds + TEXT_PADDING + (Vector2.one * 2)
|
local contentSize = textBounds + TEXT_PADDING + (Vector2.one * 2)
|
||||||
|
|
||||||
local trigger = props.Trigger:getValue()
|
local trigger = props.Trigger:getValue()
|
||||||
|
|
@ -39,7 +36,7 @@ local function Popup(props)
|
||||||
-- If there's not enough space below, and there's more space above, then show the tooltip above the trigger
|
-- If there's not enough space below, and there's more space above, then show the tooltip above the trigger
|
||||||
local displayAbove = spaceBelow < contentSize.Y and spaceAbove > spaceBelow
|
local displayAbove = spaceBelow < contentSize.Y and spaceAbove > spaceBelow
|
||||||
|
|
||||||
local X = math.clamp(props.Position.X - X_OFFSET, 0, props.parentSize.X - contentSize.X)
|
local X = math.clamp(props.Position.X - X_OFFSET, 0, math.max(props.parentSize.X - contentSize.X, 1))
|
||||||
local Y = 0
|
local Y = 0
|
||||||
|
|
||||||
if displayAbove then
|
if displayAbove then
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ function Setting:render()
|
||||||
then self.props.input
|
then self.props.input
|
||||||
elseif self.props.options ~= nil then e(Dropdown, {
|
elseif self.props.options ~= nil then e(Dropdown, {
|
||||||
locked = self.props.locked,
|
locked = self.props.locked,
|
||||||
|
lockedTooltip = self.props.lockedTooltip,
|
||||||
options = self.props.options,
|
options = self.props.options,
|
||||||
active = self.state.setting,
|
active = self.state.setting,
|
||||||
transparency = self.props.transparency,
|
transparency = self.props.transparency,
|
||||||
|
|
@ -111,6 +112,7 @@ function Setting:render()
|
||||||
})
|
})
|
||||||
else e(Checkbox, {
|
else e(Checkbox, {
|
||||||
locked = self.props.locked,
|
locked = self.props.locked,
|
||||||
|
lockedTooltip = self.props.lockedTooltip,
|
||||||
active = self.state.setting,
|
active = self.state.setting,
|
||||||
transparency = self.props.transparency,
|
transparency = self.props.transparency,
|
||||||
onClick = function()
|
onClick = function()
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,7 @@ function SettingsPage:render()
|
||||||
name = "Two-Way Sync",
|
name = "Two-Way Sync",
|
||||||
description = "Editing files in Studio will sync them into the filesystem",
|
description = "Editing files in Studio will sync them into the filesystem",
|
||||||
locked = self.props.syncActive,
|
locked = self.props.syncActive,
|
||||||
|
lockedTooltip = "(Cannot change while currently syncing. Disconnect first.)",
|
||||||
tag = "unstable",
|
tag = "unstable",
|
||||||
transparency = self.props.transparency,
|
transparency = self.props.transparency,
|
||||||
layoutOrder = layoutIncrement(),
|
layoutOrder = layoutIncrement(),
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ trait FmtLua {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
struct DisplayLua<T>(T);
|
struct DisplayLua<T>(T);
|
||||||
|
|
||||||
impl<T> fmt::Display for DisplayLua<T>
|
impl<T> fmt::Display for DisplayLua<T>
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ impl<K: Hash + Eq, V: Eq> MultiMap<K, V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get<Q: ?Sized>(&self, k: &Q) -> &[V]
|
pub fn get<Q>(&self, k: &Q) -> &[V]
|
||||||
where
|
where
|
||||||
K: Borrow<Q>,
|
K: Borrow<Q>,
|
||||||
Q: Hash + Eq,
|
Q: Hash + Eq + ?Sized,
|
||||||
{
|
{
|
||||||
self.inner.get(k).map(Vec::as_slice).unwrap_or(&[])
|
self.inner.get(k).map(Vec::as_slice).unwrap_or(&[])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ impl Project {
|
||||||
io::ErrorKind::NotFound => Error::NoProjectFound {
|
io::ErrorKind::NotFound => Error::NoProjectFound {
|
||||||
path: project_path.to_path_buf(),
|
path: project_path.to_path_buf(),
|
||||||
},
|
},
|
||||||
_ => return e.into(),
|
_ => e.into(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(Some(Self::load_from_slice(&contents, project_path, None)?))
|
Ok(Some(Self::load_from_slice(&contents, project_path, None)?))
|
||||||
|
|
@ -250,7 +250,7 @@ impl Project {
|
||||||
io::ErrorKind::NotFound => Error::NoProjectFound {
|
io::ErrorKind::NotFound => Error::NoProjectFound {
|
||||||
path: project_path.to_path_buf(),
|
path: project_path.to_path_buf(),
|
||||||
},
|
},
|
||||||
_ => return e.into(),
|
_ => e.into(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(Self::load_from_slice(
|
Ok(Self::load_from_slice(
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ mod test {
|
||||||
// addition of a prop named Self, which is a self-referential Ref.
|
// addition of a prop named Self, which is a self-referential Ref.
|
||||||
let snapshot_id = Ref::new();
|
let snapshot_id = Ref::new();
|
||||||
let snapshot = InstanceSnapshot {
|
let snapshot = InstanceSnapshot {
|
||||||
snapshot_id: snapshot_id,
|
snapshot_id,
|
||||||
properties: [("Self".to_owned(), Variant::Ref(snapshot_id))].into(),
|
properties: [("Self".to_owned(), Variant::Ref(snapshot_id))].into(),
|
||||||
|
|
||||||
metadata: Default::default(),
|
metadata: Default::default(),
|
||||||
|
|
@ -351,7 +351,7 @@ mod test {
|
||||||
// This patch describes the existing instance with a new child added.
|
// This patch describes the existing instance with a new child added.
|
||||||
let snapshot_id = Ref::new();
|
let snapshot_id = Ref::new();
|
||||||
let snapshot = InstanceSnapshot {
|
let snapshot = InstanceSnapshot {
|
||||||
snapshot_id: snapshot_id,
|
snapshot_id,
|
||||||
children: vec![InstanceSnapshot {
|
children: vec![InstanceSnapshot {
|
||||||
properties: [("Self".to_owned(), Variant::Ref(snapshot_id))].into(),
|
properties: [("Self".to_owned(), Variant::Ref(snapshot_id))].into(),
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use crate::{
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn set_name_and_class_name() {
|
fn set_name_and_class_name() {
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let mut tree = empty_tree();
|
let mut tree = empty_tree();
|
||||||
intern_tree(&tree, &mut redactions);
|
intern_tree(&tree, &mut redactions);
|
||||||
|
|
@ -36,7 +36,7 @@ fn set_name_and_class_name() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_property() {
|
fn add_property() {
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let mut tree = empty_tree();
|
let mut tree = empty_tree();
|
||||||
intern_tree(&tree, &mut redactions);
|
intern_tree(&tree, &mut redactions);
|
||||||
|
|
@ -63,7 +63,7 @@ fn add_property() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn remove_property() {
|
fn remove_property() {
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let mut tree = empty_tree();
|
let mut tree = empty_tree();
|
||||||
intern_tree(&tree, &mut redactions);
|
intern_tree(&tree, &mut redactions);
|
||||||
|
|
@ -85,7 +85,7 @@ fn remove_property() {
|
||||||
id: tree.get_root_id(),
|
id: tree.get_root_id(),
|
||||||
changed_name: None,
|
changed_name: None,
|
||||||
changed_class_name: None,
|
changed_class_name: None,
|
||||||
changed_properties: [("Foo".to_owned(), None).into()].into(),
|
changed_properties: [("Foo".to_owned(), None)].into(),
|
||||||
changed_metadata: None,
|
changed_metadata: None,
|
||||||
}],
|
}],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use crate::snapshot::{compute_patch_set, InstanceSnapshot, RojoTree};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn set_name_and_class_name() {
|
fn set_name_and_class_name() {
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let tree = empty_tree();
|
let tree = empty_tree();
|
||||||
redactions.intern(tree.get_root_id());
|
redactions.intern(tree.get_root_id());
|
||||||
|
|
@ -31,7 +31,7 @@ fn set_name_and_class_name() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn set_property() {
|
fn set_property() {
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let tree = empty_tree();
|
let tree = empty_tree();
|
||||||
redactions.intern(tree.get_root_id());
|
redactions.intern(tree.get_root_id());
|
||||||
|
|
@ -53,7 +53,7 @@ fn set_property() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn remove_property() {
|
fn remove_property() {
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let mut tree = empty_tree();
|
let mut tree = empty_tree();
|
||||||
redactions.intern(tree.get_root_id());
|
redactions.intern(tree.get_root_id());
|
||||||
|
|
@ -84,7 +84,7 @@ fn remove_property() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_child() {
|
fn add_child() {
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let tree = empty_tree();
|
let tree = empty_tree();
|
||||||
redactions.intern(tree.get_root_id());
|
redactions.intern(tree.get_root_id());
|
||||||
|
|
@ -113,7 +113,7 @@ fn add_child() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn remove_child() {
|
fn remove_child() {
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let mut tree = empty_tree();
|
let mut tree = empty_tree();
|
||||||
redactions.intern(tree.get_root_id());
|
redactions.intern(tree.get_root_id());
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ impl RojoTree {
|
||||||
// We need to uphold the invariant that each ID can only map
|
// We need to uphold the invariant that each ID can only map
|
||||||
// to one referent.
|
// to one referent.
|
||||||
if let Some(new) = &metadata.specified_id {
|
if let Some(new) = &metadata.specified_id {
|
||||||
if self.specified_id_to_refs.get(new).len() > 0 {
|
if !self.specified_id_to_refs.get(new).is_empty() {
|
||||||
log::error!("Duplicate user-specified referent '{new}'");
|
log::error!("Duplicate user-specified referent '{new}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,7 +206,7 @@ impl RojoTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(specified_id) = &metadata.specified_id {
|
if let Some(specified_id) = &metadata.specified_id {
|
||||||
if self.specified_id_to_refs.get(specified_id).len() > 0 {
|
if !self.specified_id_to_refs.get(specified_id).is_empty() {
|
||||||
log::error!("Duplicate user-specified referent '{specified_id}'");
|
log::error!("Duplicate user-specified referent '{specified_id}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,11 +177,11 @@ Ack,Ack!,,An exclamation of despair,¡Ay!"#,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_csv(
|
let instance_snapshot = snapshot_csv(
|
||||||
&InstanceContext::default(),
|
&InstanceContext::default(),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.csv"),
|
Path::new("/foo.csv"),
|
||||||
"foo",
|
"foo",
|
||||||
)
|
)
|
||||||
|
|
@ -209,11 +209,11 @@ Ack,Ack!,,An exclamation of despair,¡Ay!"#,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_csv(
|
let instance_snapshot = snapshot_csv(
|
||||||
&InstanceContext::default(),
|
&InstanceContext::default(),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.csv"),
|
Path::new("/foo.csv"),
|
||||||
"foo",
|
"foo",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -116,12 +116,11 @@ mod test {
|
||||||
imfs.load_snapshot("/foo", VfsSnapshot::empty_dir())
|
imfs.load_snapshot("/foo", VfsSnapshot::empty_dir())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot =
|
let instance_snapshot = snapshot_dir(&InstanceContext::default(), &vfs, Path::new("/foo"))
|
||||||
snapshot_dir(&InstanceContext::default(), &mut vfs, Path::new("/foo"))
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap();
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
insta::assert_yaml_snapshot!(instance_snapshot);
|
insta::assert_yaml_snapshot!(instance_snapshot);
|
||||||
}
|
}
|
||||||
|
|
@ -135,12 +134,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot =
|
let instance_snapshot = snapshot_dir(&InstanceContext::default(), &vfs, Path::new("/foo"))
|
||||||
snapshot_dir(&InstanceContext::default(), &mut vfs, Path::new("/foo"))
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap();
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
insta::assert_yaml_snapshot!(instance_snapshot);
|
insta::assert_yaml_snapshot!(instance_snapshot);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,11 +98,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs.clone());
|
let vfs = Vfs::new(imfs.clone());
|
||||||
|
|
||||||
let instance_snapshot = snapshot_json(
|
let instance_snapshot = snapshot_json(
|
||||||
&InstanceContext::default(),
|
&InstanceContext::default(),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.json"),
|
Path::new("/foo.json"),
|
||||||
"foo",
|
"foo",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -124,11 +124,11 @@ mod test {
|
||||||
imfs.load_snapshot("/foo.lua", VfsSnapshot::file("Hello there!"))
|
imfs.load_snapshot("/foo.lua", VfsSnapshot::file("Hello there!"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.lua"),
|
Path::new("/foo.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Module,
|
ScriptType::Module,
|
||||||
|
|
@ -147,11 +147,11 @@ mod test {
|
||||||
imfs.load_snapshot("/foo.lua", VfsSnapshot::file("Hello there!"))
|
imfs.load_snapshot("/foo.lua", VfsSnapshot::file("Hello there!"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.lua"),
|
Path::new("/foo.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Module,
|
ScriptType::Module,
|
||||||
|
|
@ -170,11 +170,11 @@ mod test {
|
||||||
imfs.load_snapshot("/foo.server.lua", VfsSnapshot::file("Hello there!"))
|
imfs.load_snapshot("/foo.server.lua", VfsSnapshot::file("Hello there!"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.server.lua"),
|
Path::new("/foo.server.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Server,
|
ScriptType::Server,
|
||||||
|
|
@ -193,11 +193,11 @@ mod test {
|
||||||
imfs.load_snapshot("/foo.server.lua", VfsSnapshot::file("Hello there!"))
|
imfs.load_snapshot("/foo.server.lua", VfsSnapshot::file("Hello there!"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.server.lua"),
|
Path::new("/foo.server.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Server,
|
ScriptType::Server,
|
||||||
|
|
@ -216,11 +216,11 @@ mod test {
|
||||||
imfs.load_snapshot("/foo.client.lua", VfsSnapshot::file("Hello there!"))
|
imfs.load_snapshot("/foo.client.lua", VfsSnapshot::file("Hello there!"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.client.lua"),
|
Path::new("/foo.client.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Client,
|
ScriptType::Client,
|
||||||
|
|
@ -239,11 +239,11 @@ mod test {
|
||||||
imfs.load_snapshot("/foo.client.lua", VfsSnapshot::file("Hello there!"))
|
imfs.load_snapshot("/foo.client.lua", VfsSnapshot::file("Hello there!"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.client.lua"),
|
Path::new("/foo.client.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Client,
|
ScriptType::Client,
|
||||||
|
|
@ -266,11 +266,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/root"),
|
Path::new("/root"),
|
||||||
"root",
|
"root",
|
||||||
ScriptType::Module,
|
ScriptType::Module,
|
||||||
|
|
@ -300,11 +300,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.lua"),
|
Path::new("/foo.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Module,
|
ScriptType::Module,
|
||||||
|
|
@ -334,11 +334,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.lua"),
|
Path::new("/foo.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Module,
|
ScriptType::Module,
|
||||||
|
|
@ -368,11 +368,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.server.lua"),
|
Path::new("/foo.server.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Server,
|
ScriptType::Server,
|
||||||
|
|
@ -402,11 +402,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.server.lua"),
|
Path::new("/foo.server.lua"),
|
||||||
"foo",
|
"foo",
|
||||||
ScriptType::Server,
|
ScriptType::Server,
|
||||||
|
|
@ -438,11 +438,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
&InstanceContext::with_emit_legacy_scripts(Some(true)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/bar.server.lua"),
|
Path::new("/bar.server.lua"),
|
||||||
"bar",
|
"bar",
|
||||||
ScriptType::Server,
|
ScriptType::Server,
|
||||||
|
|
@ -474,11 +474,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_lua(
|
let instance_snapshot = snapshot_lua(
|
||||||
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
&InstanceContext::with_emit_legacy_scripts(Some(false)),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/bar.server.lua"),
|
Path::new("/bar.server.lua"),
|
||||||
"bar",
|
"bar",
|
||||||
ScriptType::Server,
|
ScriptType::Server,
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_rbxm(
|
let instance_snapshot = snapshot_rbxm(
|
||||||
&InstanceContext::default(),
|
&InstanceContext::default(),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.rbxm"),
|
Path::new("/foo.rbxm"),
|
||||||
"foo",
|
"foo",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs);
|
let vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let instance_snapshot = snapshot_rbxmx(
|
let instance_snapshot = snapshot_rbxmx(
|
||||||
&InstanceContext::default(),
|
&InstanceContext::default(),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.rbxmx"),
|
Path::new("/foo.rbxmx"),
|
||||||
"foo",
|
"foo",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,11 @@ mod test {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs.clone());
|
let vfs = Vfs::new(imfs.clone());
|
||||||
|
|
||||||
let instance_snapshot = snapshot_toml(
|
let instance_snapshot = snapshot_toml(
|
||||||
&InstanceContext::default(),
|
&InstanceContext::default(),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.toml"),
|
Path::new("/foo.toml"),
|
||||||
"foo",
|
"foo",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,11 @@ mod test {
|
||||||
imfs.load_snapshot("/foo.txt", VfsSnapshot::file("Hello there!"))
|
imfs.load_snapshot("/foo.txt", VfsSnapshot::file("Hello there!"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut vfs = Vfs::new(imfs.clone());
|
let vfs = Vfs::new(imfs.clone());
|
||||||
|
|
||||||
let instance_snapshot = snapshot_txt(
|
let instance_snapshot = snapshot_txt(
|
||||||
&InstanceContext::default(),
|
&InstanceContext::default(),
|
||||||
&mut vfs,
|
&vfs,
|
||||||
Path::new("/foo.txt"),
|
Path::new("/foo.txt"),
|
||||||
"foo",
|
"foo",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ pub struct Instance<'a> {
|
||||||
pub metadata: Option<InstanceMetadata>,
|
pub metadata: Option<InstanceMetadata>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Instance<'a> {
|
impl Instance<'_> {
|
||||||
pub(crate) fn from_rojo_instance(source: InstanceWithMeta<'_>) -> Instance<'_> {
|
pub(crate) fn from_rojo_instance(source: InstanceWithMeta<'_>) -> Instance<'_> {
|
||||||
let properties = source
|
let properties = source
|
||||||
.properties()
|
.properties()
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use crate::rojo_test::io_util::{
|
||||||
pub fn run_serve_test(test_name: &str, callback: impl FnOnce(TestServeSession, RedactionMap)) {
|
pub fn run_serve_test(test_name: &str, callback: impl FnOnce(TestServeSession, RedactionMap)) {
|
||||||
let _ = env_logger::try_init();
|
let _ = env_logger::try_init();
|
||||||
|
|
||||||
let mut redactions = RedactionMap::new();
|
let mut redactions = RedactionMap::default();
|
||||||
|
|
||||||
let mut session = TestServeSession::new(test_name);
|
let mut session = TestServeSession::new(test_name);
|
||||||
let info = session.wait_to_come_online();
|
let info = session.wait_to_come_online();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue