Add rough tests to ensure broken projects stay broken

This commit is contained in:
Lucien Greathouse
2019-07-02 16:09:49 -07:00
parent ce09e57315
commit 2a0efe70a5
8 changed files with 53 additions and 8 deletions

View 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");
}
}

View File

@@ -1,5 +1,5 @@
{ {
"name": "meta_files_bad", "name": "bad_json_model",
"tree": { "tree": {
"$path": "src" "$path": "src"
} }

View File

@@ -0,0 +1,6 @@
{
"name": "bad_meta_rbxmx_properties",
"tree": {
"$path": "src"
}
}

View File

@@ -1,5 +1,5 @@
{ {
"name": "missing-files", "name": "bad_missing_files",
"tree": { "tree": {
"$path": "does-not-exist" "$path": "does-not-exist"
} }

View File

@@ -1,6 +0,0 @@
{
"name": "malformed-stuff",
"tree": {
"$path": "src"
}
}