mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 12:45:05 +00:00
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": {
|
||||
"$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": {
|
||||
"$path": "does-not-exist"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "malformed-stuff",
|
||||
"tree": {
|
||||
"$path": "src"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user