mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
json5
This commit is contained in:
parent
074e62951f
commit
cd63b5c9c0
84 changed files with 743 additions and 288 deletions
|
|
@ -163,20 +163,14 @@ impl TestServeSession {
|
|||
let url = format!("http://localhost:{}/api/rojo", self.port);
|
||||
let body = reqwest::blocking::get(url)?.text()?;
|
||||
|
||||
let value = jsonc_parser::parse_to_serde_value(&body, &Default::default())
|
||||
.expect("Failed to parse JSON")
|
||||
.expect("No JSON value");
|
||||
Ok(serde_json::from_value(value).expect("Server returned malformed response"))
|
||||
Ok(serde_json::from_str(&body).expect("Server returned malformed response"))
|
||||
}
|
||||
|
||||
pub fn get_api_read(&self, id: Ref) -> Result<ReadResponse<'_>, reqwest::Error> {
|
||||
let url = format!("http://localhost:{}/api/read/{}", self.port, id);
|
||||
let body = reqwest::blocking::get(url)?.text()?;
|
||||
|
||||
let value = jsonc_parser::parse_to_serde_value(&body, &Default::default())
|
||||
.expect("Failed to parse JSON")
|
||||
.expect("No JSON value");
|
||||
Ok(serde_json::from_value(value).expect("Server returned malformed response"))
|
||||
Ok(serde_json::from_str(&body).expect("Server returned malformed response"))
|
||||
}
|
||||
|
||||
pub fn get_api_socket_packet(
|
||||
|
|
|
|||
|
|
@ -35,21 +35,21 @@ syncback_tests! {
|
|||
// Ensures that syncback works with CSVs
|
||||
csv => ["src/csv_init/init.csv", "src/csv.csv"],
|
||||
// Ensures that if a RojoId is duplicated somewhere in the project, it's
|
||||
// rewritten rather than synced back as a conflict
|
||||
// rewritten rather than synced back as a conflict (preserves existing .json)
|
||||
duplicate_rojo_id => ["container.model.json"],
|
||||
// Ensures that the `ignorePaths` setting works for additions
|
||||
ignore_paths_adding => ["src/int_value.model.json", "src/subfolder/string_value.txt"],
|
||||
// Ensures that the `ignorePaths` setting works for additions (new files get .json5)
|
||||
ignore_paths_adding => ["src/int_value.model.json5", "src/subfolder/string_value.txt"],
|
||||
// Ensures that the `ignorePaths` setting works for `init` files
|
||||
ignore_paths_init => ["src/non-init.luau", "src/init-file/init.luau"],
|
||||
// Ensures that the `ignorePaths` setting works for removals
|
||||
ignore_paths_removing => ["src/Message.model.json"],
|
||||
// Ensures that the `ignorePaths` setting works for removals (new file gets .json5)
|
||||
ignore_paths_removing => ["src/Message.model.json5"],
|
||||
// Ensures that `ignoreTrees` works for additions
|
||||
ignore_trees_adding => [],
|
||||
// Ensures that `ignoreTrees` works for removals
|
||||
ignore_trees_removing => [],
|
||||
// Ensures that all of the JSON middlewares are handled as expected
|
||||
// Ensures that all of the JSON middlewares are handled as expected (preserves existing .json)
|
||||
json_middlewares => ["src/dir_with_meta/init.meta.json", "src/model_json.model.json", "src/project_json.project.json"],
|
||||
// Ensures projects that refer to other projects work as expected
|
||||
// Ensures projects that refer to other projects work as expected (preserves existing .json)
|
||||
nested_projects => ["nested.project.json", "string_value.txt"],
|
||||
// Ensures files that are ignored by nested projects are picked up if
|
||||
// they're included in second project. Unusual but perfectly workable
|
||||
|
|
@ -58,25 +58,25 @@ syncback_tests! {
|
|||
// Ensures that projects respect `init` files when they're directly referenced from a node
|
||||
project_init => ["src/init.luau"],
|
||||
// Ensures that projects can be reserialized by syncback and that
|
||||
// default.project.json doesn't change unexpectedly.
|
||||
// default.project.json doesn't change unexpectedly (preserves existing .json)
|
||||
project_reserialize => ["attribute_mismatch.luau", "property_mismatch.project.json"],
|
||||
// Confirms that Instances that cannot serialize as directories serialize as rbxms
|
||||
rbxm_fallback => [],
|
||||
// Ensures that ref properties are linked properly on the file system
|
||||
// Ensures that ref properties are linked properly on the file system (preserves existing .json)
|
||||
ref_properties => ["src/pointer.model.json", "src/target.model.json"],
|
||||
// Ensures that ref properties are linked when no attributes are manually
|
||||
// set in the DataModel
|
||||
ref_properties_blank => ["src/pointer.model.json", "src/target.txt"],
|
||||
// Ensures that if there is a conflict in RojoRefs, one of them is rewritten.
|
||||
// set in the DataModel (new files get .json5)
|
||||
ref_properties_blank => ["src/pointer.model.json5", "src/target.txt"],
|
||||
// Ensures that if there is a conflict in RojoRefs, one of them is rewritten (preserves existing .json)
|
||||
ref_properties_conflict => ["src/Pointer_2.model.json", "src/Target_2.model.json"],
|
||||
// Ensures that having multiple pointers that are aimed at the same target doesn't trigger ref rewrites.
|
||||
ref_properties_duplicate => [],
|
||||
// Ensures that ref properties that point to nothing after the prune both
|
||||
// do not leave any trace of themselves
|
||||
ref_properties_pruned => ["src/Pointer1.model.json", "src/Pointer2.model.json", "src/Pointer3.model.json"],
|
||||
// do not leave any trace of themselves (new files get .json5)
|
||||
ref_properties_pruned => ["src/Pointer1.model.json5", "src/Pointer2.model.json5", "src/Pointer3.model.json5"],
|
||||
// Ensures that the old middleware is respected during syncback
|
||||
respect_old_middleware => ["default.project.json", "src/model_json.model.json", "src/rbxm.rbxm", "src/rbxmx.rbxmx"],
|
||||
// Ensures that the `$schema` field roundtrips with syncback
|
||||
// Ensures that the `$schema` field roundtrips with syncback (preserves existing .json)
|
||||
schema_roundtrip => ["default.project.json", "src/model.model.json", "src/init/init.meta.json", "src/adjacent.meta.json"],
|
||||
// Ensures that StringValues inside project files are written to the
|
||||
// project file, but only if they don't have `$path` set
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue