mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-24 14:45:56 +00:00
Update disabled CSV middleware test
This commit is contained in:
@@ -131,52 +131,58 @@ fn convert_localization_csv(contents: &[u8]) -> String {
|
|||||||
serde_json::to_string(&entries).expect("Could not encode JSON for localization table")
|
serde_json::to_string(&entries).expect("Could not encode JSON for localization table")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(test, feature = "FIXME"))]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use crate::vfs::{NoopFetcher, VfsDebug, VfsSnapshot};
|
use memofs::{InMemoryFs, VfsSnapshot};
|
||||||
use insta::assert_yaml_snapshot;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn csv_from_vfs() {
|
fn csv_from_vfs() {
|
||||||
let mut vfs = Vfs::new(NoopFetcher);
|
let mut imfs = InMemoryFs::new();
|
||||||
let file = VfsSnapshot::file(
|
imfs.load_snapshot(
|
||||||
r#"
|
"/foo.csv",
|
||||||
|
VfsSnapshot::file(
|
||||||
|
r#"
|
||||||
Key,Source,Context,Example,es
|
Key,Source,Context,Example,es
|
||||||
Ack,Ack!,,An exclamation of despair,¡Ay!"#,
|
Ack,Ack!,,An exclamation of despair,¡Ay!"#,
|
||||||
);
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
vfs.debug_load_snapshot("/foo.csv", file);
|
let mut vfs = Vfs::new(imfs);
|
||||||
|
|
||||||
let entry = vfs.get("/foo.csv").unwrap();
|
|
||||||
let instance_snapshot =
|
let instance_snapshot =
|
||||||
SnapshotCsv::from_vfs(&InstanceContext::default(), &mut vfs, &entry)
|
SnapshotCsv::from_vfs(&InstanceContext::default(), &mut vfs, Path::new("/foo.csv"))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_yaml_snapshot!(instance_snapshot);
|
insta::assert_yaml_snapshot!(instance_snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn csv_with_meta() {
|
fn csv_with_meta() {
|
||||||
let mut vfs = Vfs::new(NoopFetcher);
|
let mut imfs = InMemoryFs::new();
|
||||||
let file = VfsSnapshot::file(
|
imfs.load_snapshot(
|
||||||
r#"
|
"/foo.csv",
|
||||||
|
VfsSnapshot::file(
|
||||||
|
r#"
|
||||||
Key,Source,Context,Example,es
|
Key,Source,Context,Example,es
|
||||||
Ack,Ack!,,An exclamation of despair,¡Ay!"#,
|
Ack,Ack!,,An exclamation of despair,¡Ay!"#,
|
||||||
);
|
),
|
||||||
let meta = VfsSnapshot::file(r#"{ "ignoreUnknownInstances": true }"#);
|
)
|
||||||
|
.unwrap();
|
||||||
|
imfs.load_snapshot(
|
||||||
|
"/foo.meta.json",
|
||||||
|
VfsSnapshot::file(r#"{ "ignoreUnknownInstances": true }"#),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
vfs.debug_load_snapshot("/foo.csv", file);
|
let mut vfs = Vfs::new(imfs);
|
||||||
vfs.debug_load_snapshot("/foo.meta.json", meta);
|
|
||||||
|
|
||||||
let entry = vfs.get("/foo.csv").unwrap();
|
|
||||||
let instance_snapshot =
|
let instance_snapshot =
|
||||||
SnapshotCsv::from_vfs(&InstanceContext::default(), &mut vfs, &entry)
|
SnapshotCsv::from_vfs(&InstanceContext::default(), &mut vfs, Path::new("/foo.csv"))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_yaml_snapshot!(instance_snapshot);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user