mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-25 15:16:07 +00:00
Add build tests for init.meta.json
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "init_meta_class_name",
|
||||||
|
"tree": {
|
||||||
|
"$path": "should-be-a-model"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"className": "Model"
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"className": "Lighting",
|
||||||
|
"properties": {
|
||||||
|
"Technology": "Voxel"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "init_meta_properties",
|
||||||
|
"tree": {
|
||||||
|
"$path": "Lighting"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
use std::{
|
use std::{fs, path::Path, process::Command};
|
||||||
fs,
|
|
||||||
path::Path,
|
|
||||||
process::Command,
|
|
||||||
};
|
|
||||||
|
|
||||||
use insta::assert_snapshot_matches;
|
use insta::assert_snapshot_matches;
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
@@ -27,6 +23,8 @@ gen_build_tests! {
|
|||||||
csv_bug_147,
|
csv_bug_147,
|
||||||
csv_in_folder,
|
csv_in_folder,
|
||||||
gitkeep,
|
gitkeep,
|
||||||
|
init_meta_class_name,
|
||||||
|
init_meta_properties,
|
||||||
json_model_in_folder,
|
json_model_in_folder,
|
||||||
json_model_legacy_name,
|
json_model_legacy_name,
|
||||||
module_in_folder,
|
module_in_folder,
|
||||||
@@ -56,7 +54,10 @@ fn run_build_test(test_name: &str) {
|
|||||||
|
|
||||||
let status = Command::new(exe_path)
|
let status = Command::new(exe_path)
|
||||||
.args(&[
|
.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")
|
.env("RUST_LOG", "error")
|
||||||
.current_dir(working_dir)
|
.current_dir(working_dir)
|
||||||
@@ -65,8 +66,7 @@ fn run_build_test(test_name: &str) {
|
|||||||
|
|
||||||
assert!(status.success(), "Rojo did not exit successfully");
|
assert!(status.success(), "Rojo did not exit successfully");
|
||||||
|
|
||||||
let contents = fs::read_to_string(&output_path)
|
let contents = fs::read_to_string(&output_path).expect("Couldn't read output file");
|
||||||
.expect("Couldn't read output file");
|
|
||||||
|
|
||||||
assert_snapshot_matches!(test_name, contents);
|
assert_snapshot_matches!(test_name, contents);
|
||||||
}
|
}
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
Reference in New Issue
Block a user