diff --git a/Cargo.lock b/Cargo.lock index 71a3574..bb6fdc0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,6 +19,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + [[package]] name = "bitflags" version = "1.3.2" @@ -31,6 +37,12 @@ version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "clap" version = "4.0.32" @@ -90,6 +102,81 @@ dependencies = [ "roff", ] +[[package]] +name = "concolor" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "318d6c16e73b3a900eb212ad6a82fc7d298c5ab8184c7a9998646455bc474a16" +dependencies = [ + "bitflags", + "concolor-query", + "is-terminal", +] + +[[package]] +name = "concolor-query" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82a90734b3d5dcf656e7624cca6bce9c3a90ee11f900e80141a7427ccfb3d317" + +[[package]] +name = "content_inspector" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" +dependencies = [ + "memchr", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "dunce" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" + [[package]] name = "either" version = "1.8.0" @@ -129,6 +216,27 @@ dependencies = [ "libc", ] +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + +[[package]] +name = "filetime" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "windows-sys", +] + [[package]] name = "form_urlencoded" version = "1.1.0" @@ -138,6 +246,18 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "heck" version = "0.4.0" @@ -162,6 +282,22 @@ dependencies = [ "libc", ] +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "humantime-serde" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c" +dependencies = [ + "humantime", + "serde", +] + [[package]] name = "idna" version = "0.3.0" @@ -172,6 +308,25 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + [[package]] name = "io-lifetimes" version = "1.0.3" @@ -227,6 +382,46 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi 0.2.6", + "libc", +] + [[package]] name = "nurl" version = "0.3.1" @@ -242,6 +437,7 @@ dependencies = [ "rustc-hash", "serde", "serde_json", + "trycmd", "url", ] @@ -251,6 +447,16 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +[[package]] +name = "os_pipe" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6a252f1f8c11e84b3ab59d7a488e48e4478a93937e027076638c49536204639" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "os_str_bytes" version = "6.4.1" @@ -314,6 +520,46 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rayon" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + [[package]] name = "roff" version = "0.2.1" @@ -346,6 +592,21 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + [[package]] name = "serde" version = "1.0.152" @@ -377,6 +638,46 @@ dependencies = [ "serde", ] +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + +[[package]] +name = "similar" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" + +[[package]] +name = "snapbox" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbd7b250c7243273b5aec4ca366fced84ad716d110bb7baae4814678952ebde" +dependencies = [ + "concolor", + "content_inspector", + "dunce", + "filetime", + "libc", + "normalize-line-endings", + "os_pipe", + "similar", + "snapbox-macros", + "tempfile", + "wait-timeout", + "walkdir", + "windows-sys", + "yansi", +] + +[[package]] +name = "snapbox-macros" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485e65c1203eb37244465e857d15a26d3a85a5410648ccb53b18bd44cb3a7336" + [[package]] name = "strsim" version = "0.10.0" @@ -404,6 +705,20 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + [[package]] name = "termcolor" version = "1.1.3" @@ -438,6 +753,44 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "toml_datetime" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808b51e57d0ef8f71115d8f3a01e7d3750d01c79cac4b3eda910f4389fdf92fd" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd30deba9a1cd7153c22aecf93e86df639e7b81c622b0af8d9255e989991a7b7" +dependencies = [ + "indexmap", + "itertools", + "nom8", + "serde", + "toml_datetime", +] + +[[package]] +name = "trycmd" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b37ad14571d245340fb1d56cec65507bd73571005adc63dc968aa38fa9d49" +dependencies = [ + "glob", + "humantime", + "humantime-serde", + "rayon", + "serde", + "shlex", + "snapbox", + "toml_edit", +] + [[package]] name = "unicase" version = "2.6.0" @@ -491,6 +844,26 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[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.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + [[package]] name = "winapi" version = "0.3.9" @@ -578,3 +951,9 @@ name = "windows_x86_64_msvc" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" diff --git a/Cargo.toml b/Cargo.toml index b510a35..6926155 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,9 @@ clap_complete = "4.0.7" clap_mangen = "0.2.6" url = "2.3.1" +[dev-dependencies] +trycmd = "0.14.6" + [profile.release] lto = true panic = "abort" diff --git a/tests/cmd/arg.stdout b/tests/cmd/arg.stdout new file mode 100644 index 0000000..653eaec --- /dev/null +++ b/tests/cmd/arg.stdout @@ -0,0 +1,7 @@ +fetchFromGitHub { + owner = "Koihik"; + repo = "LuaFormatter"; + rev = "1.3.0"; + hash = "sha256-O42sNIFDi2Dv6KWkBynrR60RABCAitSVTp42W6w0tcg="; + fetchSubmodules = true; +} \ No newline at end of file diff --git a/tests/cmd/arg.toml b/tests/cmd/arg.toml new file mode 100644 index 0000000..4cd7b11 --- /dev/null +++ b/tests/cmd/arg.toml @@ -0,0 +1,7 @@ +args = [ + "https://github.com/Koihik/LuaFormatter", + "1.3.0", + "--arg", + "fetchSubmodules", + "true", +] diff --git a/tests/cmd/arg_str.stdout b/tests/cmd/arg_str.stdout new file mode 100644 index 0000000..60d234d --- /dev/null +++ b/tests/cmd/arg_str.stdout @@ -0,0 +1,7 @@ +fetchFromGitHub { + owner = "nix-community"; + repo = "nurl"; + rev = "v0.3.0"; + hash = "sha256-jZ+cCp1THDhfHH5yMmRPjGuthOqsgcF/3OjZ61FMdA4="; + name = "nurl-src"; +} \ No newline at end of file diff --git a/tests/cmd/arg_str.toml b/tests/cmd/arg_str.toml new file mode 100644 index 0000000..d785baf --- /dev/null +++ b/tests/cmd/arg_str.toml @@ -0,0 +1,7 @@ +args = [ + "https://github.com/nix-community/nurl", + "v0.3.0", + "--arg-str", + "name", + "nurl-src", +] diff --git a/tests/cmd/fetcher/bitbucket.stdout b/tests/cmd/fetcher/bitbucket.stdout new file mode 100644 index 0000000..fb3d5e8 --- /dev/null +++ b/tests/cmd/fetcher/bitbucket.stdout @@ -0,0 +1,6 @@ +fetchFromBitbucket { + owner = "asbuch"; + repo = "lrcalc"; + rev = "lrcalc-2.0"; + hash = "sha256-9u2tNAp1DDPHu7FtFZWDrVkqCeFCyz0RI8oXmmSwj5I="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/bitbucket.toml b/tests/cmd/fetcher/bitbucket.toml new file mode 100644 index 0000000..d0b4518 --- /dev/null +++ b/tests/cmd/fetcher/bitbucket.toml @@ -0,0 +1 @@ +args = ["https://bitbucket.org/asbuch/lrcalc", "lrcalc-2.0"] diff --git a/tests/cmd/fetcher/git/basic.stdout b/tests/cmd/fetcher/git/basic.stdout new file mode 100644 index 0000000..b8815d8 --- /dev/null +++ b/tests/cmd/fetcher/git/basic.stdout @@ -0,0 +1,5 @@ +fetchgit { + url = "https://github.com/nix-community/nurl"; + rev = "refs/tags/v0.3.0"; + hash = "sha256-jZ+cCp1THDhfHH5yMmRPjGuthOqsgcF/3OjZ61FMdA4="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/git/basic.toml b/tests/cmd/fetcher/git/basic.toml new file mode 100644 index 0000000..5e43477 --- /dev/null +++ b/tests/cmd/fetcher/git/basic.toml @@ -0,0 +1,6 @@ +args = [ + "https://github.com/nix-community/nurl", + "refs/tags/v0.3.0", + "--fetcher", + "fetchgit", +] diff --git a/tests/cmd/fetcher/git/scheme.stdout b/tests/cmd/fetcher/git/scheme.stdout new file mode 100644 index 0000000..23a0a1b --- /dev/null +++ b/tests/cmd/fetcher/git/scheme.stdout @@ -0,0 +1,5 @@ +fetchgit { + url = "git://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git"; + rev = "refs/tags/v1.9.0"; + hash = "sha256-W38CWoPnkt0+VkVp+uW+sjWjo6MXYq2eTXRxWKyQph8="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/git/scheme.toml b/tests/cmd/fetcher/git/scheme.toml new file mode 100644 index 0000000..fd4d444 --- /dev/null +++ b/tests/cmd/fetcher/git/scheme.toml @@ -0,0 +1,6 @@ +args = [ + "git://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git", + "refs/tags/v1.9.0", + "--fetcher", + "fetchgit", +] diff --git a/tests/cmd/fetcher/git/scheme_plus.stdout b/tests/cmd/fetcher/git/scheme_plus.stdout new file mode 100644 index 0000000..b8815d8 --- /dev/null +++ b/tests/cmd/fetcher/git/scheme_plus.stdout @@ -0,0 +1,5 @@ +fetchgit { + url = "https://github.com/nix-community/nurl"; + rev = "refs/tags/v0.3.0"; + hash = "sha256-jZ+cCp1THDhfHH5yMmRPjGuthOqsgcF/3OjZ61FMdA4="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/git/scheme_plus.toml b/tests/cmd/fetcher/git/scheme_plus.toml new file mode 100644 index 0000000..fa239c2 --- /dev/null +++ b/tests/cmd/fetcher/git/scheme_plus.toml @@ -0,0 +1,6 @@ +args = [ + "git+https://github.com/nix-community/nurl", + "refs/tags/v0.3.0", + "--fetcher", + "fetchgit", +] diff --git a/tests/cmd/fetcher/gitea.stdout b/tests/cmd/fetcher/gitea.stdout new file mode 100644 index 0000000..ecdfade --- /dev/null +++ b/tests/cmd/fetcher/gitea.stdout @@ -0,0 +1,7 @@ +fetchFromGitea { + domain = "codeberg.org"; + owner = "nsxiv"; + repo = "nsxiv"; + rev = "v30"; + hash = "sha256-swzTdQ6ow1At4bKRORqz6fb0Ej92yU9rlI/OgcinPu4="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/gitea.toml b/tests/cmd/fetcher/gitea.toml new file mode 100644 index 0000000..fdc7d54 --- /dev/null +++ b/tests/cmd/fetcher/gitea.toml @@ -0,0 +1 @@ +args = ["https://codeberg.org/nsxiv/nsxiv", "v30"] diff --git a/tests/cmd/fetcher/github.stdout b/tests/cmd/fetcher/github.stdout new file mode 100644 index 0000000..7fa4578 --- /dev/null +++ b/tests/cmd/fetcher/github.stdout @@ -0,0 +1,6 @@ +fetchFromGitHub { + owner = "nix-community"; + repo = "nurl"; + rev = "v0.3.0"; + hash = "sha256-jZ+cCp1THDhfHH5yMmRPjGuthOqsgcF/3OjZ61FMdA4="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/github.toml b/tests/cmd/fetcher/github.toml new file mode 100644 index 0000000..d33868b --- /dev/null +++ b/tests/cmd/fetcher/github.toml @@ -0,0 +1 @@ +args = ["https://github.com/nix-community/nurl", "v0.3.0"] diff --git a/tests/cmd/fetcher/gitiles.stdout b/tests/cmd/fetcher/gitiles.stdout new file mode 100644 index 0000000..1198333 --- /dev/null +++ b/tests/cmd/fetcher/gitiles.stdout @@ -0,0 +1,5 @@ +fetchFromGitiles { + url = "https://android.googlesource.com/platform/external/minijail"; + rev = "linux-v18"; + hash = "sha256-OpwzISZ5iZNQvJAX7UJJ4gELEaVfcQgY9cqMM0YvBzc="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/gitiles.toml b/tests/cmd/fetcher/gitiles.toml new file mode 100644 index 0000000..dce7e36 --- /dev/null +++ b/tests/cmd/fetcher/gitiles.toml @@ -0,0 +1 @@ +args = ["https://android.googlesource.com/platform/external/minijail", "linux-v18"] diff --git a/tests/cmd/fetcher/gitlab/basic.stdout b/tests/cmd/fetcher/gitlab/basic.stdout new file mode 100644 index 0000000..efc6008 --- /dev/null +++ b/tests/cmd/fetcher/gitlab/basic.stdout @@ -0,0 +1,6 @@ +fetchFromGitLab { + owner = "timvisee"; + repo = "ffsend"; + rev = "v0.2.0"; + hash = "sha256-0+ekty3dK3IVkFiNn3/NxOPJhkp3ZkTKaVC404t2Rac="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/gitlab/basic.toml b/tests/cmd/fetcher/gitlab/basic.toml new file mode 100644 index 0000000..4b824fa --- /dev/null +++ b/tests/cmd/fetcher/gitlab/basic.toml @@ -0,0 +1 @@ +args = ["https://gitlab.com/timvisee/ffsend", "v0.2.0"] diff --git a/tests/cmd/fetcher/gitlab/group.stdout b/tests/cmd/fetcher/gitlab/group.stdout new file mode 100644 index 0000000..540953a --- /dev/null +++ b/tests/cmd/fetcher/gitlab/group.stdout @@ -0,0 +1,8 @@ +fetchFromGitLab { + domain = "gitlab.gnome.org"; + group = "World"; + owner = "Phosh"; + repo = "phosh"; + rev = "v0.20.0"; + hash = "sha256-KKoRAUqy9l/Y/R7iLqZe6sHcyHHvRRTj+WeVmyAm7+I="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/gitlab/group.toml b/tests/cmd/fetcher/gitlab/group.toml new file mode 100644 index 0000000..4c410c7 --- /dev/null +++ b/tests/cmd/fetcher/gitlab/group.toml @@ -0,0 +1 @@ +args = ["https://gitlab.gnome.org/World/Phosh/phosh", "v0.20.0"] diff --git a/tests/cmd/fetcher/gitlab/instance.stdout b/tests/cmd/fetcher/gitlab/instance.stdout new file mode 100644 index 0000000..ace4df2 --- /dev/null +++ b/tests/cmd/fetcher/gitlab/instance.stdout @@ -0,0 +1,7 @@ +fetchFromGitLab { + domain = "gitlab.gnome.org"; + owner = "GNOME"; + repo = "libadwaita"; + rev = "1.2.0"; + hash = "sha256-3lH7Vi9M8k+GSrCpvruRpLrIpMoOakKbcJlaAc/FK+U="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/gitlab/instance.toml b/tests/cmd/fetcher/gitlab/instance.toml new file mode 100644 index 0000000..98f820a --- /dev/null +++ b/tests/cmd/fetcher/gitlab/instance.toml @@ -0,0 +1 @@ +args = ["https://gitlab.gnome.org/GNOME/libadwaita", "1.2.0"] diff --git a/tests/cmd/fetcher/gitlab/trailing_slash.stdout b/tests/cmd/fetcher/gitlab/trailing_slash.stdout new file mode 100644 index 0000000..efc6008 --- /dev/null +++ b/tests/cmd/fetcher/gitlab/trailing_slash.stdout @@ -0,0 +1,6 @@ +fetchFromGitLab { + owner = "timvisee"; + repo = "ffsend"; + rev = "v0.2.0"; + hash = "sha256-0+ekty3dK3IVkFiNn3/NxOPJhkp3ZkTKaVC404t2Rac="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/gitlab/trailing_slash.toml b/tests/cmd/fetcher/gitlab/trailing_slash.toml new file mode 100644 index 0000000..b96d2bf --- /dev/null +++ b/tests/cmd/fetcher/gitlab/trailing_slash.toml @@ -0,0 +1 @@ +args = ["https://gitlab.com/timvisee/ffsend/", "v0.2.0"] diff --git a/tests/cmd/fetcher/hg/basic.stdout b/tests/cmd/fetcher/hg/basic.stdout new file mode 100644 index 0000000..399c484 --- /dev/null +++ b/tests/cmd/fetcher/hg/basic.stdout @@ -0,0 +1,5 @@ +fetchhg { + url = "https://hg.sr.ht/~scoopta/wofi"; + rev = "v1.3"; + hash = "sha256-GxMjEXBPQniD+Yc9QZjd8TH4ILJAX5dNzrjxDawhy8w="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/hg/basic.toml b/tests/cmd/fetcher/hg/basic.toml new file mode 100644 index 0000000..418e7ea --- /dev/null +++ b/tests/cmd/fetcher/hg/basic.toml @@ -0,0 +1 @@ +args = ["https://hg.sr.ht/~scoopta/wofi", "v1.3", "--fetcher", "fetchhg"] diff --git a/tests/cmd/fetcher/hg/scheme_plus.stdout b/tests/cmd/fetcher/hg/scheme_plus.stdout new file mode 100644 index 0000000..399c484 --- /dev/null +++ b/tests/cmd/fetcher/hg/scheme_plus.stdout @@ -0,0 +1,5 @@ +fetchhg { + url = "https://hg.sr.ht/~scoopta/wofi"; + rev = "v1.3"; + hash = "sha256-GxMjEXBPQniD+Yc9QZjd8TH4ILJAX5dNzrjxDawhy8w="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/hg/scheme_plus.toml b/tests/cmd/fetcher/hg/scheme_plus.toml new file mode 100644 index 0000000..3c38117 --- /dev/null +++ b/tests/cmd/fetcher/hg/scheme_plus.toml @@ -0,0 +1 @@ +args = ["hg+https://hg.sr.ht/~scoopta/wofi", "v1.3", "--fetcher", "fetchhg"] diff --git a/tests/cmd/fetcher/repo_or_cz.stdout b/tests/cmd/fetcher/repo_or_cz.stdout new file mode 100644 index 0000000..42f707a --- /dev/null +++ b/tests/cmd/fetcher/repo_or_cz.stdout @@ -0,0 +1,5 @@ +fetchFromRepoOrCz { + repo = "tinycc"; + rev = "release_0_9_27"; + hash = "sha256-5yRaB/gxk1Gm/rukAe0pm1PEl5NdieVFngp87jENtYo="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/repo_or_cz.toml b/tests/cmd/fetcher/repo_or_cz.toml new file mode 100644 index 0000000..122e866 --- /dev/null +++ b/tests/cmd/fetcher/repo_or_cz.toml @@ -0,0 +1 @@ +args = ["https://repo.or.cz/tinycc.git", "release_0_9_27"] diff --git a/tests/cmd/fetcher/sourcehut.stdout b/tests/cmd/fetcher/sourcehut.stdout new file mode 100644 index 0000000..7fe227f --- /dev/null +++ b/tests/cmd/fetcher/sourcehut.stdout @@ -0,0 +1,6 @@ +fetchFromSourcehut { + owner = "~sircmpwn"; + repo = "core.sr.ht"; + rev = "0.60.0"; + hash = "sha256-d2lfBMf5dJeqvTT6NWPNDSuYC3Hgof8PanYwSHqOCEk="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/sourcehut.toml b/tests/cmd/fetcher/sourcehut.toml new file mode 100644 index 0000000..45a894a --- /dev/null +++ b/tests/cmd/fetcher/sourcehut.toml @@ -0,0 +1 @@ +args = ["https://git.sr.ht/~sircmpwn/core.sr.ht", "0.60.0"] diff --git a/tests/cmd/fetcher/svn.stdout b/tests/cmd/fetcher/svn.stdout new file mode 100644 index 0000000..63ae2d6 --- /dev/null +++ b/tests/cmd/fetcher/svn.stdout @@ -0,0 +1,5 @@ +fetchsvn { + url = "svn://svn.mplayerhq.hu/mplayer/trunk"; + rev = "30000"; + sha256 = "sha256-gmiB9GR2VfzTzdIWe6kVCldaau6Cq0F9J0exFZChT1o="; +} \ No newline at end of file diff --git a/tests/cmd/fetcher/svn.toml b/tests/cmd/fetcher/svn.toml new file mode 100644 index 0000000..79c34a5 --- /dev/null +++ b/tests/cmd/fetcher/svn.toml @@ -0,0 +1 @@ +args = ["svn://svn.mplayerhq.hu/mplayer/trunk", "30000"] diff --git a/tests/cmd/indent.stdout b/tests/cmd/indent.stdout new file mode 100644 index 0000000..23a08d7 --- /dev/null +++ b/tests/cmd/indent.stdout @@ -0,0 +1,6 @@ +fetchFromGitHub { + owner = "nix-community"; + repo = "nurl"; + rev = "v0.3.0"; + hash = "sha256-jZ+cCp1THDhfHH5yMmRPjGuthOqsgcF/3OjZ61FMdA4="; + } \ No newline at end of file diff --git a/tests/cmd/indent.toml b/tests/cmd/indent.toml new file mode 100644 index 0000000..53b6e42 --- /dev/null +++ b/tests/cmd/indent.toml @@ -0,0 +1 @@ +args = ["https://github.com/nix-community/nurl", "v0.3.0", "--indent", "2"] diff --git a/tests/cmd/json.stdout b/tests/cmd/json.stdout new file mode 100644 index 0000000..66633d1 --- /dev/null +++ b/tests/cmd/json.stdout @@ -0,0 +1 @@ +{"args":{"hash":"sha256-jZ+cCp1THDhfHH5yMmRPjGuthOqsgcF/3OjZ61FMdA4=","owner":"nix-community","repo":"nurl","rev":"v0.3.0"},"fetcher":"fetchFromGitHub"} \ No newline at end of file diff --git a/tests/cmd/json.toml b/tests/cmd/json.toml new file mode 100644 index 0000000..87c9f81 --- /dev/null +++ b/tests/cmd/json.toml @@ -0,0 +1 @@ +args = ["https://github.com/nix-community/nurl", "v0.3.0", "--json"] diff --git a/tests/cmd/overwrite.stdout b/tests/cmd/overwrite.stdout new file mode 100644 index 0000000..f46ce0a --- /dev/null +++ b/tests/cmd/overwrite.stdout @@ -0,0 +1,6 @@ +fetchFromGitHub { + owner = "nix-community"; + repo = pname; + rev = "v0.3.0"; + hash = "sha256-jZ+cCp1THDhfHH5yMmRPjGuthOqsgcF/3OjZ61FMdA4="; +} \ No newline at end of file diff --git a/tests/cmd/overwrite.toml b/tests/cmd/overwrite.toml new file mode 100644 index 0000000..cb34115 --- /dev/null +++ b/tests/cmd/overwrite.toml @@ -0,0 +1,7 @@ +args = [ + "https://github.com/nix-community/nurl", + "v0.3.0", + "--overwrite", + "repo", + "pname", +] diff --git a/tests/cmd/overwrite_str.stdout b/tests/cmd/overwrite_str.stdout new file mode 100644 index 0000000..9cf8fba --- /dev/null +++ b/tests/cmd/overwrite_str.stdout @@ -0,0 +1,6 @@ +fetchFromGitHub { + owner = "nix-community"; + repo = "nurl"; + rev = "v${version}"; + hash = "sha256-jZ+cCp1THDhfHH5yMmRPjGuthOqsgcF/3OjZ61FMdA4="; +} \ No newline at end of file diff --git a/tests/cmd/overwrite_str.toml b/tests/cmd/overwrite_str.toml new file mode 100644 index 0000000..8b0efb3 --- /dev/null +++ b/tests/cmd/overwrite_str.toml @@ -0,0 +1,7 @@ +args = [ + "https://github.com/nix-community/nurl", + "v0.3.0", + "--overwrite-str", + "rev", + "v${version}", +] diff --git a/tests/integration.rs b/tests/integration.rs new file mode 100644 index 0000000..b3ce41d --- /dev/null +++ b/tests/integration.rs @@ -0,0 +1,8 @@ +use trycmd::TestCases; + +#[test] +fn integration() { + TestCases::new() + .default_bin_name("nurl") + .case("tests/cmd/**/*.toml"); +}