Skip to content

Commit

Permalink
test: updated snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Nov 10, 2024
1 parent ee22d0d commit a86e372
Show file tree
Hide file tree
Showing 155 changed files with 215 additions and 94 deletions.
4 changes: 1 addition & 3 deletions src/cli/alias/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ mod tests {
fn test_alias_get() {
reset();
let stdout = assert_cli!("alias", "get", "tiny", "my/alias");
assert_snapshot!(stdout, @r###"
3.0
"###);
assert_snapshot!(stdout, @"3.0");
}

#[test]
Expand Down
8 changes: 4 additions & 4 deletions src/cli/alias/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mod tests {
#[test]
fn test_alias_ls() {
reset();
assert_cli_snapshot!("aliases", @r#"
assert_cli_snapshot!("aliases", @r"
java lts 21
node lts 22
node lts-argon 4
Expand All @@ -92,16 +92,16 @@ mod tests {
tiny lts 3.1.0
tiny lts-prev 2.0.0
tiny my/alias 3.0
"#);
");
}

#[test]
fn test_alias_ls_filter() {
reset();
assert_cli_snapshot!("aliases", "ls", "tiny", @r###"
assert_cli_snapshot!("aliases", "ls", "tiny", @r"
tiny lts 3.1.0
tiny lts-prev 2.0.0
tiny my/alias 3.0
"###);
");
}
}
4 changes: 2 additions & 2 deletions src/cli/alias/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub mod tests {
reset();
assert_cli!("alias", "set", "tiny", "my/alias", "3.0");

assert_cli_snapshot!("aliases", @r#"
assert_cli_snapshot!("aliases", @r"
java lts 21
node lts 22
node lts-argon 4
Expand All @@ -58,7 +58,7 @@ pub mod tests {
tiny lts 3.1.0
tiny lts-prev 2.0.0
tiny my/alias 3.0
"#);
");
reset();
}
}
4 changes: 2 additions & 2 deletions src/cli/alias/unset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mod tests {
reset();

assert_cli!("alias", "unset", "tiny", "my/alias");
assert_cli_snapshot!("aliases", @r#"
assert_cli_snapshot!("aliases", @r"
java lts 21
node lts 22
node lts-argon 4
Expand All @@ -55,7 +55,7 @@ mod tests {
node lts-jod 22
tiny lts 3.1.0
tiny lts-prev 2.0.0
"#);
");

reset();
}
Expand Down
8 changes: 3 additions & 5 deletions src/cli/asdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,19 @@ mod tests {
assert_cli!("uninstall", "--all", "tiny");
assert_cli!("install", "tiny@1", "tiny@2");
assert_cli!("asdf", "install", "tiny");
assert_cli_snapshot!("asdf", "list", "tiny", @r#"
assert_cli_snapshot!("asdf", "list", "tiny", @r"
1.0.1
2.1.0
3.1.0
"#);
");
}

#[test]
fn test_fake_asdf_other() {
reset();
assert_cli!("uninstall", "--all", "tiny");
assert_cli!("install", "tiny@3.1.0");
assert_cli_snapshot!("asdf", "current", "tiny", @r###"
3.1.0
"###);
assert_cli_snapshot!("asdf", "current", "tiny", @"3.1.0");
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/backends/ls.rs
expression: output
snapshot_kind: text
---
cargo
core
Expand Down
4 changes: 2 additions & 2 deletions src/cli/bin_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ mod tests {
fn test_bin_paths() {
reset();
assert_cli!("i");
assert_cli_snapshot!("bin-paths", @r#"
assert_cli_snapshot!("bin-paths", @r"
~/data/installs/tiny/3.1.0/bin
~/data/installs/dummy/ref-master/bin
"#);
");
}
}
8 changes: 2 additions & 6 deletions src/cli/cache/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,12 @@ mod tests {
#[test]
fn test_cache_clear() {
reset();
assert_cli_snapshot!("cache", "clear", @r###"
mise cache cleared
"###);
assert_cli_snapshot!("cache", "clear", @"mise cache cleared");
}

#[test]
fn test_cache_clear_plugin() {
reset();
assert_cli_snapshot!("cache", "clear", "tiny", @r###"
mise cache cleared for tiny
"###);
assert_cli_snapshot!("cache", "clear", "tiny", @"mise cache cleared for tiny");
}
}
4 changes: 2 additions & 2 deletions src/cli/config/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ mod tests {
#[test]
fn test_config_ls() {
reset();
assert_cli_snapshot!("cfg", "--no-headers", @r###"
assert_cli_snapshot!("cfg", "--no-headers", @r"
~/cwd/.test-tool-versions tiny
~/.test-tool-versions tiny, dummy
~/config/config.toml (none)
"###);
");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/cli/config/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ mod tests {
assert_cli_snapshot!("config", "get", "settings.jobs", @"4");

assert_cli_snapshot!("config", "set", "settings.disable_tools", "--type", "list", "node,rust", @"");
assert_cli_snapshot!("config", "get", "settings.disable_tools", @"[\"node\", \"rust\"]");
assert_cli_snapshot!("config", "get", "settings.disable_tools", @r#"["node", "rust"]"#);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/config/generate.rs
expression: output
snapshot_kind: text
---
# # mise config files are hierarchical. mise will find all of the config files
# # in all parent directories and merge them together.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/config/get.rs
expression: output
snapshot_kind: text
---
[alias.tiny]
"my/alias" = "3.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/config/ls.rs
expression: output
snapshot_kind: text
---
[
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/direnv/envrc.rs
expression: envrc
snapshot_kind: text
---
### Do not edit. This was autogenerated by 'asdf direnv envrc' ###
watch_file ~/cwd/.test-tool-versions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/generate/git_pre_commit.rs
expression: output
snapshot_kind: text
---
#!/bin/sh
mise run testing123
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/generate/git_pre_commit.rs
expression: "file::read_to_string(&path).unwrap()"
snapshot_kind: text
---
#!/bin/sh
mise run pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/cli/generate/git_pre_commit.rs
expression: output
snapshot_kind: text
---
Wrote to ~/cwd/.git/hooks/testing123
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/generate/github_action.rs
expression: output
snapshot_kind: text
---
name: ci

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/generate/github_action.rs
expression: contents
snapshot_kind: text
---
name: testing123

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/cli/generate/github_action.rs
expression: output
snapshot_kind: text
---
Wrote to ~/cwd/.github/workflows/testing123.yml
4 changes: 2 additions & 2 deletions src/cli/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ mod tests {
assert_cli!("install", "tiny@3.0.1", "tiny@3.1.0");
create_dir_all("../data/tmp/tiny").unwrap();
assert_cli!("link", "tiny@9.8.7", "../data/tmp/tiny");
assert_cli_snapshot!("ls", "tiny", @r###"
assert_cli_snapshot!("ls", "tiny", @r"
tiny 1.0.1
tiny 2.1.0
tiny 3.0.1
tiny 3.1.0 ~/cwd/.test-tool-versions 3
tiny 9.8.7 (symlink)
"###);
");
assert_cli!("uninstall", "tiny@9.8.7");
}
}
32 changes: 16 additions & 16 deletions src/cli/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,45 +415,45 @@ mod tests {
reset();
let _ = remove_all(*dirs::INSTALLS);
assert_cli!("install");
assert_cli_snapshot!("list", @r###"
assert_cli_snapshot!("list", @r"
dummy ref:master ~/.test-tool-versions ref:master
tiny 3.1.0 ~/cwd/.test-tool-versions 3
"###);
");

assert_cli!("install", "tiny@2.0.0");
assert_cli_snapshot!("list", @r###"
assert_cli_snapshot!("list", @r"
dummy ref:master ~/.test-tool-versions ref:master
tiny 2.0.0
tiny 3.1.0 ~/cwd/.test-tool-versions 3
"###);
");

assert_cli!("uninstall", "tiny@3.1.0");
assert_cli_snapshot!("list", @r###"
assert_cli_snapshot!("list", @r"
dummy ref:master ~/.test-tool-versions ref:master
tiny 2.0.0
tiny 3.1.0 (missing) ~/cwd/.test-tool-versions 3
"###);
");

assert_cli!("uninstall", "tiny@2.0.0");
assert_cli_snapshot!("list", @r###"
assert_cli_snapshot!("list", @r"
dummy ref:master ~/.test-tool-versions ref:master
tiny 3.1.0 (missing) ~/cwd/.test-tool-versions 3
"###);
");

assert_cli!("install");
assert_cli_snapshot!("list", @r###"
assert_cli_snapshot!("list", @r"
dummy ref:master ~/.test-tool-versions ref:master
tiny 3.1.0 ~/cwd/.test-tool-versions 3
"###);
");
}

#[test]
fn test_ls_current() {
reset();
assert_cli_snapshot!("ls", "-c", @r###"
assert_cli_snapshot!("ls", "-c", @r"
dummy ref:master ~/.test-tool-versions ref:master
tiny 3.1.0 ~/cwd/.test-tool-versions 3
"###);
");
}

#[test]
Expand All @@ -470,17 +470,17 @@ mod tests {
reset();
let _ = remove_all(*dirs::INSTALLS);
assert_cli!("install");
assert_cli_snapshot!("ls", "--parseable", @r###"
assert_cli_snapshot!("ls", "--parseable", @r"
dummy ref:master
tiny 3.1.0
mise The parseable output format is deprecated and will be removed in a future release.
mise Please use the regular output format instead which has been modified to be more easily parseable.
"###);
assert_cli_snapshot!("ls", "--parseable", "tiny", @r###"
");
assert_cli_snapshot!("ls", "--parseable", "tiny", @r"
3.1.0
mise The parseable output format is deprecated and will be removed in a future release.
mise Please use the regular output format instead which has been modified to be more easily parseable.
"###);
");
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/plugins/ls.rs
expression: output
snapshot_kind: text
---
dummy
tiny
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/cli/plugins/ls.rs
expression: "grep(stdout, \"zephyr\")"
snapshot_kind: text
---
zephyr https://github.com/nsaunders/asdf-zephyr.git
8 changes: 2 additions & 6 deletions src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,7 @@ mod tests {
"arg4"
, @"");
let body = file::read_to_string("test-build-output.txt").unwrap();
assert_snapshot!(body, @r###"
TEST_BUILDSCRIPT_ENV_VAR: VALID
"###);
assert_snapshot!(body, @"TEST_BUILDSCRIPT_ENV_VAR: VALID");
}

#[test]
Expand All @@ -801,9 +799,7 @@ mod tests {
"shell",
@"");
let body = file::read_to_string("test-build-output.txt").unwrap();
assert_snapshot!(body, @r###"
using shell bash
"###);
assert_snapshot!(body, @"using shell bash");
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/cli/settings/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mod tests {
fn test_settings_get() {
reset();
assert_cli_snapshot!("settings", "get", "legacy_version_file", @"true");
assert_cli_snapshot!("settings", "get", "status.missing_tools", @r###""if_other_versions_installed""###);
assert_cli_snapshot!("settings", "get", "status.missing_tools", @r#""if_other_versions_installed""#);
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/cli/asdf.rs
expression: "assert_cli!(\"asdf\", \"install\", \"tiny\")"
snapshot_kind: text
---

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/cli/asdf.rs
expression: output
snapshot_kind: text
---

Loading

0 comments on commit a86e372

Please sign in to comment.