forked from rojo-rbx/rojo
Add rough tests to ensure broken projects stay broken
This commit is contained in:
45
server/tests/malformed_projects.rs
Normal file
45
server/tests/malformed_projects.rs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
use std::{
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
|
use librojo::{
|
||||||
|
live_session::LiveSession,
|
||||||
|
project::Project,
|
||||||
|
};
|
||||||
|
|
||||||
|
lazy_static::lazy_static! {
|
||||||
|
static ref TEST_PROJECTS_ROOT: PathBuf = {
|
||||||
|
Path::new(env!("CARGO_MANIFEST_DIR")).join("../test-projects")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bad_json_model() {
|
||||||
|
let project = Project::load_fuzzy(&TEST_PROJECTS_ROOT.join("bad_json_model"))
|
||||||
|
.expect("Project file didn't load");
|
||||||
|
|
||||||
|
if LiveSession::new(Arc::new(project)).is_ok() {
|
||||||
|
panic!("Project should not have succeeded");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bad_meta_rbxmx_properties() {
|
||||||
|
let project = Project::load_fuzzy(&TEST_PROJECTS_ROOT.join("bad_meta_rbxmx_properties"))
|
||||||
|
.expect("Project file didn't load");
|
||||||
|
|
||||||
|
if LiveSession::new(Arc::new(project)).is_ok() {
|
||||||
|
panic!("Project should not have succeeded");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bad_missing_files() {
|
||||||
|
let project = Project::load_fuzzy(&TEST_PROJECTS_ROOT.join("bad_missing_files"))
|
||||||
|
.expect("Project file didn't load");
|
||||||
|
|
||||||
|
if LiveSession::new(Arc::new(project)).is_ok() {
|
||||||
|
panic!("Project should not have succeeded");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "meta_files_bad",
|
"name": "bad_json_model",
|
||||||
"tree": {
|
"tree": {
|
||||||
"$path": "src"
|
"$path": "src"
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "bad_meta_rbxmx_properties",
|
||||||
|
"tree": {
|
||||||
|
"$path": "src"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "missing-files",
|
"name": "bad_missing_files",
|
||||||
"tree": {
|
"tree": {
|
||||||
"$path": "does-not-exist"
|
"$path": "does-not-exist"
|
||||||
}
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "malformed-stuff",
|
|
||||||
"tree": {
|
|
||||||
"$path": "src"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user