Remove maplit dependency and stop using a macro for hashmaps (#982)

This commit is contained in:
Micah
2024-10-31 11:56:54 -07:00
committed by GitHub
parent d9ab0e7de8
commit 34106f470f
13 changed files with 111 additions and 108 deletions

View File

@@ -340,7 +340,6 @@ fn infer_class_name(name: &str, parent_class: Option<&str>) -> Option<Cow<'stati
mod test {
use super::*;
use maplit::hashmap;
use memofs::{InMemoryFs, VfsSnapshot};
#[ignore = "Functionality moved to root snapshot middleware"]
@@ -351,16 +350,19 @@ mod test {
let mut imfs = InMemoryFs::new();
imfs.load_snapshot(
"/foo",
VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
VfsSnapshot::dir([(
"default.project.json",
VfsSnapshot::file(
r#"
{
"name": "indirect-project",
"tree": {
"$className": "Folder"
}
}
"#),
}),
"#,
),
)]),
)
.unwrap();
@@ -385,16 +387,19 @@ mod test {
let mut imfs = InMemoryFs::new();
imfs.load_snapshot(
"/foo",
VfsSnapshot::dir(hashmap! {
"hello.project.json" => VfsSnapshot::file(r#"
VfsSnapshot::dir([(
"hello.project.json",
VfsSnapshot::file(
r#"
{
"name": "direct-project",
"tree": {
"$className": "Model"
}
}
"#),
}),
"#,
),
)]),
)
.unwrap();
@@ -533,17 +538,22 @@ mod test {
let mut imfs = InMemoryFs::new();
imfs.load_snapshot(
"/foo",
VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
VfsSnapshot::dir([
(
"default.project.json",
VfsSnapshot::file(
r#"
{
"name": "path-project",
"tree": {
"$path": "other.txt"
}
}
"#),
"other.txt" => VfsSnapshot::file("Hello, world!"),
}),
"#,
),
),
("other.txt", VfsSnapshot::file("Hello, world!")),
]),
)
.unwrap();
@@ -568,24 +578,34 @@ mod test {
let mut imfs = InMemoryFs::new();
imfs.load_snapshot(
"/foo",
VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
VfsSnapshot::dir([
(
"default.project.json",
VfsSnapshot::file(
r#"
{
"name": "path-project",
"tree": {
"$path": "other.project.json"
}
}
"#),
"other.project.json" => VfsSnapshot::file(r#"
"#,
),
),
(
"other.project.json",
VfsSnapshot::file(
r#"
{
"name": "other-project",
"tree": {
"$className": "Model"
}
}
"#),
}),
"#,
),
),
]),
)
.unwrap();
@@ -610,16 +630,24 @@ mod test {
let mut imfs = InMemoryFs::new();
imfs.load_snapshot(
"/foo",
VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
VfsSnapshot::dir([
(
"default.project.json",
VfsSnapshot::file(
r#"
{
"name": "path-child-project",
"tree": {
"$path": "other.project.json"
}
}
"#),
"other.project.json" => VfsSnapshot::file(r#"
"#,
),
),
(
"other.project.json",
VfsSnapshot::file(
r#"
{
"name": "other-project",
"tree": {
@@ -630,8 +658,10 @@ mod test {
}
}
}
"#),
}),
"#,
),
),
]),
)
.unwrap();
@@ -659,8 +689,11 @@ mod test {
let mut imfs = InMemoryFs::new();
imfs.load_snapshot(
"/foo",
VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
VfsSnapshot::dir([
(
"default.project.json",
VfsSnapshot::file(
r#"
{
"name": "path-property-override",
"tree": {
@@ -670,8 +703,13 @@ mod test {
}
}
}
"#),
"other.project.json" => VfsSnapshot::file(r#"
"#,
),
),
(
"other.project.json",
VfsSnapshot::file(
r#"
{
"name": "other-project",
"tree": {
@@ -681,8 +719,10 @@ mod test {
}
}
}
"#),
}),
"#,
),
),
]),
)
.unwrap();
@@ -707,15 +747,18 @@ mod test {
let mut imfs = InMemoryFs::new();
imfs.load_snapshot(
"/foo",
VfsSnapshot::dir(hashmap! {
"default.project.json" => VfsSnapshot::file(r#"
VfsSnapshot::dir([(
"default.project.json",
VfsSnapshot::file(
r#"
{
"tree": {
"$className": "Model"
}
}
"#),
}),
"#,
),
)]),
)
.unwrap();