Add build tests for init.meta.json

This commit is contained in:
Lucien Greathouse
2019-10-12 23:54:39 -07:00
parent 2c408f4047
commit 126040a87b
7 changed files with 53 additions and 9 deletions

View File

@@ -0,0 +1,6 @@
{
"name": "init_meta_class_name",
"tree": {
"$path": "should-be-a-model"
}
}

View File

@@ -0,0 +1,3 @@
{
"className": "Model"
}

View File

@@ -0,0 +1,6 @@
{
"className": "Lighting",
"properties": {
"Technology": "Voxel"
}
}

View File

@@ -0,0 +1,6 @@
{
"name": "init_meta_properties",
"tree": {
"$path": "Lighting"
}
}

View File

@@ -1,8 +1,4 @@
use std::{
fs,
path::Path,
process::Command,
};
use std::{fs, path::Path, process::Command};
use insta::assert_snapshot_matches;
use tempfile::tempdir;
@@ -27,6 +23,8 @@ gen_build_tests! {
csv_bug_147,
csv_in_folder,
gitkeep,
init_meta_class_name,
init_meta_properties,
json_model_in_folder,
json_model_legacy_name,
module_in_folder,
@@ -56,7 +54,10 @@ fn run_build_test(test_name: &str) {
let status = Command::new(exe_path)
.args(&[
"build", input_path.to_str().unwrap(), "-o", output_path.to_str().unwrap(),
"build",
input_path.to_str().unwrap(),
"-o",
output_path.to_str().unwrap(),
])
.env("RUST_LOG", "error")
.current_dir(working_dir)
@@ -65,8 +66,7 @@ fn run_build_test(test_name: &str) {
assert!(status.success(), "Rojo did not exit successfully");
let contents = fs::read_to_string(&output_path)
.expect("Couldn't read output file");
let contents = fs::read_to_string(&output_path).expect("Couldn't read output file");
assert_snapshot_matches!(test_name, contents);
}
}

View File

@@ -0,0 +1,11 @@
---
source: rojo-test/src/build_test.rs
expression: contents
---
<roblox version="4">
<Item class="Model" referent="0">
<Properties>
<string name="Name">init_meta_class_name</string>
</Properties>
</Item>
</roblox>

View File

@@ -0,0 +1,12 @@
---
source: rojo-test/src/build_test.rs
expression: contents
---
<roblox version="4">
<Item class="Lighting" referent="0">
<Properties>
<string name="Name">init_meta_properties</string>
<token name="Technology">1</token>
</Properties>
</Item>
</roblox>