From 126040a87b33d8310d4aa7d26eb350b334639104 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Sat, 12 Oct 2019 23:54:39 -0700 Subject: [PATCH] Add build tests for init.meta.json --- .../init_meta_class_name/default.project.json | 6 ++++++ .../should-be-a-model/init.meta.json | 3 +++ .../Lighting/init.meta.json | 6 ++++++ .../init_meta_properties/default.project.json | 6 ++++++ rojo-test/src/build_test.rs | 18 +++++++++--------- .../build_test__init_meta_class_name.snap | 11 +++++++++++ .../build_test__init_meta_properties.snap | 12 ++++++++++++ 7 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 rojo-test/build-tests/init_meta_class_name/default.project.json create mode 100644 rojo-test/build-tests/init_meta_class_name/should-be-a-model/init.meta.json create mode 100644 rojo-test/build-tests/init_meta_properties/Lighting/init.meta.json create mode 100644 rojo-test/build-tests/init_meta_properties/default.project.json create mode 100644 rojo-test/src/snapshots/build_test__init_meta_class_name.snap create mode 100644 rojo-test/src/snapshots/build_test__init_meta_properties.snap diff --git a/rojo-test/build-tests/init_meta_class_name/default.project.json b/rojo-test/build-tests/init_meta_class_name/default.project.json new file mode 100644 index 00000000..0cf270c2 --- /dev/null +++ b/rojo-test/build-tests/init_meta_class_name/default.project.json @@ -0,0 +1,6 @@ +{ + "name": "init_meta_class_name", + "tree": { + "$path": "should-be-a-model" + } +} \ No newline at end of file diff --git a/rojo-test/build-tests/init_meta_class_name/should-be-a-model/init.meta.json b/rojo-test/build-tests/init_meta_class_name/should-be-a-model/init.meta.json new file mode 100644 index 00000000..5b52f5e4 --- /dev/null +++ b/rojo-test/build-tests/init_meta_class_name/should-be-a-model/init.meta.json @@ -0,0 +1,3 @@ +{ + "className": "Model" +} \ No newline at end of file diff --git a/rojo-test/build-tests/init_meta_properties/Lighting/init.meta.json b/rojo-test/build-tests/init_meta_properties/Lighting/init.meta.json new file mode 100644 index 00000000..ec43ab19 --- /dev/null +++ b/rojo-test/build-tests/init_meta_properties/Lighting/init.meta.json @@ -0,0 +1,6 @@ +{ + "className": "Lighting", + "properties": { + "Technology": "Voxel" + } +} \ No newline at end of file diff --git a/rojo-test/build-tests/init_meta_properties/default.project.json b/rojo-test/build-tests/init_meta_properties/default.project.json new file mode 100644 index 00000000..84e602f0 --- /dev/null +++ b/rojo-test/build-tests/init_meta_properties/default.project.json @@ -0,0 +1,6 @@ +{ + "name": "init_meta_properties", + "tree": { + "$path": "Lighting" + } +} \ No newline at end of file diff --git a/rojo-test/src/build_test.rs b/rojo-test/src/build_test.rs index 821a4933..3afc2fbd 100644 --- a/rojo-test/src/build_test.rs +++ b/rojo-test/src/build_test.rs @@ -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); -} \ No newline at end of file +} diff --git a/rojo-test/src/snapshots/build_test__init_meta_class_name.snap b/rojo-test/src/snapshots/build_test__init_meta_class_name.snap new file mode 100644 index 00000000..8a5f8a06 --- /dev/null +++ b/rojo-test/src/snapshots/build_test__init_meta_class_name.snap @@ -0,0 +1,11 @@ +--- +source: rojo-test/src/build_test.rs +expression: contents +--- + + + + init_meta_class_name + + + diff --git a/rojo-test/src/snapshots/build_test__init_meta_properties.snap b/rojo-test/src/snapshots/build_test__init_meta_properties.snap new file mode 100644 index 00000000..5d24b949 --- /dev/null +++ b/rojo-test/src/snapshots/build_test__init_meta_properties.snap @@ -0,0 +1,12 @@ +--- +source: rojo-test/src/build_test.rs +expression: contents +--- + + + + init_meta_properties + 1 + + +