From 5f76059c366669f48bc08daeb86989905e029e5d Mon Sep 17 00:00:00 2001 From: David Peter Date: Sat, 22 Jun 2024 22:01:46 +0200 Subject: [PATCH] Add integration test, fix themes --- Cargo.lock | 113 ++++++++++++++++++++++++++++++++++++ Cargo.toml | 3 + tests/main.rs | 19 ++++++ themes/dracula.yml | 3 + themes/lava.yml | 3 + themes/modus-operandi.yml | 3 + themes/nord.yml | 3 + themes/solarized-dark.yml | 3 + themes/solarized-light.yml | 3 + themes/tokyonight-moon.yml | 3 + themes/tokyonight-night.yml | 3 + themes/tokyonight-storm.yml | 3 + 12 files changed, 162 insertions(+) create mode 100644 tests/main.rs diff --git a/Cargo.lock b/Cargo.lock index 675cbcc..98e4632 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,6 +60,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "assert_cmd" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" +dependencies = [ + "anstyle", + "bstr", + "doc-comment", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + [[package]] name = "bitflags" version = "2.5.0" @@ -75,6 +90,17 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bstr" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + [[package]] name = "bytemuck" version = "1.16.1" @@ -140,6 +166,12 @@ dependencies = [ "typenum", ] +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + [[package]] name = "digest" version = "0.10.7" @@ -150,6 +182,12 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "errno" version = "0.3.9" @@ -220,6 +258,39 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "predicates" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" +dependencies = [ + "anstyle", + "difflib", + "predicates-core", +] + +[[package]] +name = "predicates-core" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" + +[[package]] +name = "predicates-tree" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +dependencies = [ + "predicates-core", + "termtree", +] + [[package]] name = "proc-macro2" version = "1.0.86" @@ -238,6 +309,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" + [[package]] name = "rgb" version = "0.8.37" @@ -303,6 +380,26 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha2" version = "0.10.8" @@ -341,6 +438,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "termtree" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" + [[package]] name = "typenum" version = "1.17.0" @@ -370,6 +473,7 @@ name = "vivid" version = "0.10.0" dependencies = [ "ansi_colours", + "assert_cmd", "clap", "etcetera", "lazy_static", @@ -377,6 +481,15 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index 64d44a4..a9c404e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,3 +27,6 @@ features = ["suggestions", "color", "wrap_help", "cargo"] lto = true strip = true codegen-units = 1 + +[dev-dependencies] +assert_cmd = "2.0.14" diff --git a/tests/main.rs b/tests/main.rs new file mode 100644 index 0000000..0b24693 --- /dev/null +++ b/tests/main.rs @@ -0,0 +1,19 @@ +use assert_cmd::Command; + +#[test] +fn can_call_vivid_generate_for_all_themes() { + let themes_dir = std::fs::read_dir("themes").unwrap(); + for theme in themes_dir { + let theme = theme.unwrap(); + let theme_path = theme.path(); + let theme_name = theme_path + .file_stem() + .unwrap() + .to_string_lossy() + .replace(".yml", ""); + + let mut cmd = Command::cargo_bin("vivid").unwrap(); + + cmd.arg("generate").arg(theme_name).assert().success(); + } +} diff --git a/themes/dracula.yml b/themes/dracula.yml index 6578796..709bc64 100644 --- a/themes/dracula.yml +++ b/themes/dracula.yml @@ -129,6 +129,9 @@ media: fonts: foreground: orange + 3d: + foreground: pink + office: foreground: orange diff --git a/themes/lava.yml b/themes/lava.yml index 8aec3fa..d7ece01 100644 --- a/themes/lava.yml +++ b/themes/lava.yml @@ -140,6 +140,9 @@ media: fonts: foreground: kourkinova + 3d: + foreground: kourkinova + office: foreground: christine font-style: bold diff --git a/themes/modus-operandi.yml b/themes/modus-operandi.yml index f319037..cd73cbd 100644 --- a/themes/modus-operandi.yml +++ b/themes/modus-operandi.yml @@ -149,6 +149,9 @@ media: fonts: foreground: magenta + 3d: + foreground: magenta + office: foreground: yellow diff --git a/themes/nord.yml b/themes/nord.yml index 77a06c0..f6a5cdf 100644 --- a/themes/nord.yml +++ b/themes/nord.yml @@ -132,6 +132,9 @@ media: fonts: foreground: aurora-nord15 + + 3d: + foreground: aurora-nord15 office: foreground: aurora-nord15 diff --git a/themes/solarized-dark.yml b/themes/solarized-dark.yml index 975a3b5..98aadf5 100644 --- a/themes/solarized-dark.yml +++ b/themes/solarized-dark.yml @@ -130,6 +130,9 @@ media: fonts: foreground: violet + 3d: + foreground: magenta + office: foreground: orange diff --git a/themes/solarized-light.yml b/themes/solarized-light.yml index 40e0c37..d8eca89 100644 --- a/themes/solarized-light.yml +++ b/themes/solarized-light.yml @@ -130,6 +130,9 @@ media: fonts: foreground: violet + 3d: + foreground: magenta + office: foreground: orange diff --git a/themes/tokyonight-moon.yml b/themes/tokyonight-moon.yml index 7c11bab..1a26a55 100644 --- a/themes/tokyonight-moon.yml +++ b/themes/tokyonight-moon.yml @@ -135,6 +135,9 @@ media: fonts: foreground: blue2 font-style: bold + 3d: + foreground: magenta + font-style: bold office: foreground: pink diff --git a/themes/tokyonight-night.yml b/themes/tokyonight-night.yml index 0b2b425..1237258 100644 --- a/themes/tokyonight-night.yml +++ b/themes/tokyonight-night.yml @@ -136,6 +136,9 @@ media: fonts: foreground: green2 font-style: bold + 3d: + foreground: purple1 + font-style: bold office: foreground: purple2 diff --git a/themes/tokyonight-storm.yml b/themes/tokyonight-storm.yml index 4fbbc20..f990303 100644 --- a/themes/tokyonight-storm.yml +++ b/themes/tokyonight-storm.yml @@ -136,6 +136,9 @@ media: fonts: foreground: green2 font-style: bold + 3d: + foreground: purple1 + font-style: bold office: foreground: purple2