summaryrefslogtreecommitdiffstats
path: root/vendor/snapbox
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/snapbox')
-rw-r--r--vendor/snapbox/.cargo-checksum.json2
-rw-r--r--vendor/snapbox/Cargo.lock343
-rw-r--r--vendor/snapbox/Cargo.toml63
-rw-r--r--vendor/snapbox/examples/snap-example-fixture.rs60
-rw-r--r--vendor/snapbox/src/assert.rs49
-rw-r--r--vendor/snapbox/src/cmd.rs146
-rw-r--r--vendor/snapbox/src/harness.rs4
-rw-r--r--vendor/snapbox/src/path.rs1
-rw-r--r--vendor/snapbox/src/report/color.rs128
-rw-r--r--vendor/snapbox/src/report/diff.rs18
10 files changed, 557 insertions, 257 deletions
diff --git a/vendor/snapbox/.cargo-checksum.json b/vendor/snapbox/.cargo-checksum.json
index 656d9137e..29dab1bd3 100644
--- a/vendor/snapbox/.cargo-checksum.json
+++ b/vendor/snapbox/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.lock":"774033150fcec11c62319d0f8b2922cb5ff1ee966a6993a67e1d1be48b905499","Cargo.toml":"7902b577196e9b505bd9767950993dcb2c8d754b9dbc8416cf274d336b209723","README.md":"8ae45cfbc76984049c97e7bdee5e0a6709f2bff442895e0c08701a71338aa0f9","src/action.rs":"a451e85e74fe43b5162a144927151e3785ef36c8d67f16f6ec3da3c6f371ca12","src/assert.rs":"2cdbcdae79eed9de512e5c1e4cd9730bbdf60e52e7c4571d0912d58a4ed5a2be","src/bin/snap-fixture.rs":"3e60c11a785b24b3e9997d5e66e0839179f23b105451509d6faf280819e75fdb","src/cmd.rs":"c5cbd67d3011ef938bed7879f776ed8112841577e36deef4950e5adf190b6ac5","src/data.rs":"15fff2855ff6cc3d8ae3ddc95867dbc82d21d24a10697ad95497f81c9252f09d","src/error.rs":"ed67eaa4e134937e1f014a0f5555985d26a021bd7034e2928ff3e46f73d7834a","src/harness.rs":"7b1edc9d9154fda3740e561faf4e474f5519448bba8c9bb170efc45f4fa9a8b9","src/lib.rs":"2599d022ee5b3f0230f6e4927fece30cd25688aeefdbfb37300ac5a2b26cb15e","src/path.rs":"f3bb7f1378fcd4ad1e54e63067cff304d15e83d40c116c83043258ef644feb56","src/report/color.rs":"4e2c6b178af0557e8e843fdaf64bfc1f73a7c46ad74505117b58f7037769ba2f","src/report/diff.rs":"7949c36e1d14849eb318355abf55e82dbf9fdeb8b2a47ae2838852c2af7cab91","src/report/mod.rs":"84bd389fff126b5a22790865417c3b8942cced343d56659ad9f8b568e3d62902","src/substitutions.rs":"e31dd94d4d2426384f8995ad3e827205c7fe836859f1e48be411998f0b5c2035","src/utils/lines.rs":"9a8eff80b4eced8042cecd2a5bf689365a9ceeea8b4239dcee22a6daad2522ec","src/utils/mod.rs":"61e6a1c2bbefa33a7f8af4068a42a7ad31bfefa90803610374f28be4a2f3b9c3"},"package":"827c00e91b15e2674d8a5270bae91f898693cbf9561cbb58d8eaa31974597293"} \ No newline at end of file
+{"files":{"Cargo.lock":"9df18d11680475680755e5c44c14937455acbfba9a45bc49f474eb96c0ad47a0","Cargo.toml":"171949aa9a155b0a32b0ae62d2cb3dd3238afc9e3b09ae6d562e177658120272","README.md":"8ae45cfbc76984049c97e7bdee5e0a6709f2bff442895e0c08701a71338aa0f9","examples/snap-example-fixture.rs":"3e60c11a785b24b3e9997d5e66e0839179f23b105451509d6faf280819e75fdb","src/action.rs":"a451e85e74fe43b5162a144927151e3785ef36c8d67f16f6ec3da3c6f371ca12","src/assert.rs":"2fe76edef1fd05a8eadfa6e8a6b1dce8629b6e4f1fd4ce85d98b1a51eafacac4","src/bin/snap-fixture.rs":"3e60c11a785b24b3e9997d5e66e0839179f23b105451509d6faf280819e75fdb","src/cmd.rs":"a4c1a3b0a39be6c012d5c661e6c06a121b12b9458a6f5b886163c65f251a1974","src/data.rs":"15fff2855ff6cc3d8ae3ddc95867dbc82d21d24a10697ad95497f81c9252f09d","src/error.rs":"ed67eaa4e134937e1f014a0f5555985d26a021bd7034e2928ff3e46f73d7834a","src/harness.rs":"1035e9cca946671c8ccf1604e549355308859a43938b35a8c0d1aa452448d146","src/lib.rs":"2599d022ee5b3f0230f6e4927fece30cd25688aeefdbfb37300ac5a2b26cb15e","src/path.rs":"7a554c93a4811072c225931fe56a47c7cdd3d83dfc66aeccbebc10e290bdd2c2","src/report/color.rs":"30652ca0a431b276586a93e615d3b8e60e142a1b8256ad9b4d627344f6126aa4","src/report/diff.rs":"5821817a6729084e8eb48818b5c3fccbdcbe48b35842d101ff33c4b8208c13c6","src/report/mod.rs":"84bd389fff126b5a22790865417c3b8942cced343d56659ad9f8b568e3d62902","src/substitutions.rs":"e31dd94d4d2426384f8995ad3e827205c7fe836859f1e48be411998f0b5c2035","src/utils/lines.rs":"9a8eff80b4eced8042cecd2a5bf689365a9ceeea8b4239dcee22a6daad2522ec","src/utils/mod.rs":"61e6a1c2bbefa33a7f8af4068a42a7ad31bfefa90803610374f28be4a2f3b9c3"},"package":"9615402f9cff539301119bdf2c2f328739cf2b45c2116666618fb6ac399f75bb"} \ No newline at end of file
diff --git a/vendor/snapbox/Cargo.lock b/vendor/snapbox/Cargo.lock
index 60d7b2ef0..7344648d5 100644
--- a/vendor/snapbox/Cargo.lock
+++ b/vendor/snapbox/Cargo.lock
@@ -19,29 +19,52 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
-version = "0.7.19"
+version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
+checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
-name = "atty"
-version = "0.2.14"
+name = "anstream"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
+checksum = "fd0982309face56a044e935a18bbffcddeb1ce72e69a3ecc3bafb56d4e959f37"
dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-wincon",
+ "concolor-override",
+ "concolor-query",
+ "is-terminal",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "80c697cc33851b02ab0c26b2e8a211684fbe627ff1cc506131f35026dd7686dd"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116"
+dependencies = [
+ "utf8parse",
]
[[package]]
-name = "autocfg"
-version = "1.1.0"
+name = "anstyle-wincon"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa"
+dependencies = [
+ "anstyle",
+ "windows-sys 0.45.0",
+]
[[package]]
name = "backtrace"
@@ -75,9 +98,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.0.74"
+version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574"
+checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-if"
@@ -87,26 +110,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
-version = "3.2.23"
+version = "4.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
+checksum = "0acbd8d28a0a60d7108d7ae850af6ba34cf2d1257fc646980e5f97ce14275966"
dependencies = [
- "atty",
"bitflags",
"clap_derive",
"clap_lex",
- "indexmap",
+ "is-terminal",
"once_cell",
"strsim",
"termcolor",
- "textwrap",
]
[[package]]
name = "clap_derive"
-version = "3.2.18"
+version = "4.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
+checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014"
dependencies = [
"heck",
"proc-macro-error",
@@ -117,29 +138,27 @@ dependencies = [
[[package]]
name = "clap_lex"
-version = "0.2.4"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
+checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
dependencies = [
"os_str_bytes",
]
[[package]]
-name = "concolor"
-version = "0.0.9"
+name = "concolor-override"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b90f9dcd9490a97db91a85ccd79e38a87e14323f0bb824659ee3274e9143ba37"
-dependencies = [
- "atty",
- "bitflags",
- "concolor-query",
-]
+checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f"
[[package]]
name = "concolor-query"
-version = "0.1.0"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82a90734b3d5dcf656e7624cca6bce9c3a90ee11f900e80141a7427ccfb3d317"
+checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf"
+dependencies = [
+ "windows-sys 0.45.0",
+]
[[package]]
name = "content_inspector"
@@ -152,11 +171,12 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.12"
+version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"
+checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"
dependencies = [
"cfg-if",
+ "once_cell",
]
[[package]]
@@ -170,9 +190,42 @@ dependencies = [
[[package]]
name = "dunce"
-version = "1.0.3"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541"
+
+[[package]]
+name = "errno"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c"
+checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
+dependencies = [
+ "errno-dragonfly",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "errno-dragonfly"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
+dependencies = [
+ "cc",
+ "libc",
+]
+
+[[package]]
+name = "escargot"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f5584ba17d7ab26a8a7284f13e5bd196294dd2f2d79773cff29b9e9edef601a6"
+dependencies = [
+ "log",
+ "once_cell",
+ "serde",
+ "serde_json",
+]
[[package]]
name = "fastrand"
@@ -192,7 +245,7 @@ dependencies = [
"cfg-if",
"libc",
"redox_syscall",
- "windows-sys",
+ "windows-sys 0.42.0",
]
[[package]]
@@ -221,12 +274,6 @@ dependencies = [
]
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -242,6 +289,12 @@ dependencies = [
]
[[package]]
+name = "hermit-abi"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
+
+[[package]]
name = "ignore"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -260,29 +313,41 @@ dependencies = [
]
[[package]]
-name = "indexmap"
-version = "1.9.1"
+name = "instant"
+version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
- "autocfg",
- "hashbrown",
+ "cfg-if",
]
[[package]]
-name = "instant"
-version = "0.1.12"
+name = "io-lifetimes"
+version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
+checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
dependencies = [
- "cfg-if",
+ "libc",
+ "windows-sys 0.45.0",
+]
+
+[[package]]
+name = "is-terminal"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857"
+dependencies = [
+ "hermit-abi 0.3.1",
+ "io-lifetimes",
+ "rustix",
+ "windows-sys 0.45.0",
]
[[package]]
name = "itoa"
-version = "1.0.4"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
+checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
name = "lazy_static"
@@ -292,15 +357,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.137"
+version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
+checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "libtest-mimic"
-version = "0.5.2"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79529479c298f5af41375b0c1a77ef670d450b4c9cd7949d2b43af08121b20ec"
+checksum = "d7b603516767d1ab23d0de09d023e62966c3322f7148297c35cf3d97aa8b37fa"
dependencies = [
"clap",
"termcolor",
@@ -308,6 +373,12 @@ dependencies = [
]
[[package]]
+name = "linux-raw-sys"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
+
+[[package]]
name = "litrs"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -330,9 +401,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "miniz_oxide"
-version = "0.5.4"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
+checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc"
dependencies = [
"adler",
]
@@ -345,11 +416,11 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
[[package]]
name = "num_cpus"
-version = "1.14.0"
+version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
+checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [
- "hermit-abi",
+ "hermit-abi 0.1.19",
"libc",
]
@@ -364,15 +435,15 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.16.0"
+version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
+checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e"
[[package]]
name = "os_pipe"
-version = "1.1.1"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dceb7e43f59c35ee1548045b2c72945a5a3bb6ce6d6f07cdc13dc8f6bc4930a"
+checksum = "2c92f2b54f081d635c77e7120862d48db8e91f7f21cef23ab1b4fe9971c59f55"
dependencies = [
"libc",
"winapi",
@@ -380,9 +451,9 @@ dependencies = [
[[package]]
name = "os_str_bytes"
-version = "6.3.1"
+version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9"
+checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
[[package]]
name = "proc-macro-error"
@@ -410,9 +481,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.47"
+version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
+checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
dependencies = [
"unicode-ident",
]
@@ -468,6 +539,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
+name = "rustix"
+version = "0.36.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
+dependencies = [
+ "bitflags",
+ "errno",
+ "io-lifetimes",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys 0.45.0",
+]
+
+[[package]]
name = "ryu"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -484,15 +569,29 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.147"
+version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
+checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.145"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
[[package]]
name = "serde_json"
-version = "1.0.87"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
+checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
dependencies = [
"itoa",
"ryu",
@@ -507,13 +606,15 @@ checksum = "62ac7f900db32bf3fd12e0117dd3dc4da74bc52ebaac97f39668446d89694803"
[[package]]
name = "snapbox"
-version = "0.4.1"
+version = "0.4.10"
dependencies = [
+ "anstream",
+ "anstyle",
"backtrace",
- "concolor",
"content_inspector",
"document-features",
"dunce",
+ "escargot",
"filetime",
"ignore",
"libc",
@@ -526,15 +627,17 @@ dependencies = [
"tempfile",
"wait-timeout",
"walkdir",
- "winapi",
- "yansi",
+ "windows-sys 0.45.0",
]
[[package]]
name = "snapbox-macros"
-version = "0.3.1"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "485e65c1203eb37244465e857d15a26d3a85a5410648ccb53b18bd44cb3a7336"
+checksum = "f8e40c667388ed1cb5060f545d0013bf0a23efdfa6c5c3e9ef592de391cd860f"
+dependencies = [
+ "anstream",
+]
[[package]]
name = "strsim"
@@ -544,9 +647,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
-version = "1.0.103"
+version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
+checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13"
dependencies = [
"proc-macro2",
"quote",
@@ -577,12 +680,6 @@ dependencies = [
]
[[package]]
-name = "textwrap"
-version = "0.16.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
-
-[[package]]
name = "thread_local"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -602,9 +699,15 @@ dependencies = [
[[package]]
name = "unicode-ident"
-version = "1.0.5"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
+checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
+
+[[package]]
+name = "utf8parse"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "version_check"
@@ -679,49 +782,67 @@ dependencies = [
]
[[package]]
+name = "windows-sys"
+version = "0.45.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.42.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.42.0"
+version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
+checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]]
name = "windows_aarch64_msvc"
-version = "0.42.0"
+version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
+checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_i686_gnu"
-version = "0.42.0"
+version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
+checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_msvc"
-version = "0.42.0"
+version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
+checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.42.0"
+version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
+checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnullvm"
-version = "0.42.0"
+version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
+checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]]
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"
+version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
+checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
diff --git a/vendor/snapbox/Cargo.toml b/vendor/snapbox/Cargo.toml
index 47ddda15f..a9a74e141 100644
--- a/vendor/snapbox/Cargo.toml
+++ b/vendor/snapbox/Cargo.toml
@@ -11,9 +11,9 @@
[package]
edition = "2021"
-rust-version = "1.60.0"
+rust-version = "1.64.0"
name = "snapbox"
-version = "0.4.1"
+version = "0.4.10"
include = [
"build.rs",
"src/**/*",
@@ -45,7 +45,7 @@ rustdoc-args = [
]
cargo-args = [
"-Zunstable-options",
- "-Zrustdoc-scrape-examples=examples",
+ "-Zrustdoc-scrape-examples",
]
[[package.metadata.release.pre-release-replacements]]
@@ -86,13 +86,15 @@ exactly = 1
[[bin]]
name = "snap-fixture"
-[dependencies.backtrace]
-version = "0.3"
+[dependencies.anstream]
+version = "0.2.1"
optional = true
-[dependencies.concolor]
-version = "0.0.9"
-features = ["std"]
+[dependencies.anstyle]
+version = "0.3.1"
+
+[dependencies.backtrace]
+version = "0.3"
optional = true
[dependencies.content_inspector]
@@ -107,6 +109,10 @@ optional = true
version = "1.0"
optional = true
+[dependencies.escargot]
+version = "0.5.7"
+optional = true
+
[dependencies.filetime]
version = "0.2"
optional = true
@@ -115,12 +121,8 @@ optional = true
version = "0.4"
optional = true
-[dependencies.libc]
-version = "0.2.137"
-optional = true
-
[dependencies.libtest-mimic]
-version = "0.5.2"
+version = "0.6.0"
optional = true
[dependencies.normalize-line-endings]
@@ -140,7 +142,7 @@ features = ["inline"]
optional = true
[dependencies.snapbox-macros]
-version = "0.3.0"
+version = "0.3.3"
[dependencies.tempfile]
version = "3.0"
@@ -154,33 +156,18 @@ optional = true
version = "2.3.2"
optional = true
-[dependencies.winapi]
-version = "0.3.9"
-features = [
- "consoleapi",
- "minwindef",
-]
-optional = true
-
-[dependencies.yansi]
-version = "0.5.0"
-optional = true
-
[features]
cmd = [
"dep:os_pipe",
"dep:wait-timeout",
"dep:libc",
- "dep:winapi",
+ "dep:windows-sys",
]
color = [
- "dep:yansi",
- "concolor",
-]
-color-auto = [
- "color",
- "concolor/auto",
+ "dep:anstream",
+ "snapbox-macros/color",
]
+color-auto = ["color"]
debug = [
"snapbox-macros/debug",
"dep:backtrace",
@@ -191,6 +178,7 @@ default = [
]
detect-encoding = ["dep:content_inspector"]
diff = ["dep:similar"]
+examples = ["dep:escargot"]
harness = [
"dep:libtest-mimic",
"dep:ignore",
@@ -204,3 +192,12 @@ path = [
"dep:filetime",
]
structured-data = ["dep:serde_json"]
+
+[target."cfg(unix)".dependencies.libc]
+version = "0.2.137"
+optional = true
+
+[target."cfg(windows)".dependencies.windows-sys]
+version = "0.45.0"
+features = ["Win32_Foundation"]
+optional = true
diff --git a/vendor/snapbox/examples/snap-example-fixture.rs b/vendor/snapbox/examples/snap-example-fixture.rs
new file mode 100644
index 000000000..6e13448a7
--- /dev/null
+++ b/vendor/snapbox/examples/snap-example-fixture.rs
@@ -0,0 +1,60 @@
+//! For `snapbox`s tests only
+
+use std::env;
+use std::error::Error;
+use std::io;
+use std::io::Write;
+use std::process;
+
+fn run() -> Result<(), Box<dyn Error>> {
+ if let Ok(text) = env::var("stdout") {
+ println!("{}", text);
+ }
+ if let Ok(text) = env::var("stderr") {
+ eprintln!("{}", text);
+ }
+
+ if env::var("echo_large").as_deref() == Ok("1") {
+ for i in 0..(128 * 1024) {
+ println!("{}", i);
+ }
+ }
+
+ if env::var("echo_cwd").as_deref() == Ok("1") {
+ if let Ok(cwd) = std::env::current_dir() {
+ eprintln!("{}", cwd.display());
+ }
+ }
+
+ if let Ok(raw) = env::var("write") {
+ let (path, text) = raw.split_once('=').unwrap_or((raw.as_str(), ""));
+ std::fs::write(path.trim(), text.trim()).unwrap();
+ }
+
+ if let Ok(path) = env::var("cat") {
+ let text = std::fs::read_to_string(path).unwrap();
+ eprintln!("{}", text);
+ }
+
+ if let Some(timeout) = env::var("sleep").ok().and_then(|s| s.parse().ok()) {
+ std::thread::sleep(std::time::Duration::from_secs(timeout));
+ }
+
+ let code = env::var("exit")
+ .ok()
+ .map(|v| v.parse::<i32>())
+ .map_or(Ok(None), |r| r.map(Some))?
+ .unwrap_or(0);
+ process::exit(code);
+}
+
+fn main() {
+ let code = match run() {
+ Ok(_) => 0,
+ Err(ref e) => {
+ write!(&mut io::stderr(), "{}", e).expect("writing to stderr won't fail");
+ 1
+ }
+ };
+ process::exit(code);
+}
diff --git a/vendor/snapbox/src/assert.rs b/vendor/snapbox/src/assert.rs
index ab87f1554..f0267c071 100644
--- a/vendor/snapbox/src/assert.rs
+++ b/vendor/snapbox/src/assert.rs
@@ -1,3 +1,10 @@
+#[cfg(feature = "color")]
+use anstream::panic;
+#[cfg(feature = "color")]
+use anstream::stderr;
+#[cfg(not(feature = "color"))]
+use std::io::stderr;
+
use crate::data::{DataFormat, NormalizeMatches, NormalizeNewlines, NormalizePaths};
use crate::Action;
@@ -232,36 +239,25 @@ impl Assert {
use std::io::Write;
let _ = writeln!(
- std::io::stderr(),
+ stderr(),
"{}: {}",
self.palette.warn("Ignoring failure"),
err
);
}
Action::Verify => {
- use std::fmt::Write;
- let mut buffer = String::new();
- write!(&mut buffer, "{}", err).unwrap();
- if let Some(action_var) = self.action_var.as_deref() {
- writeln!(
- &mut buffer,
- "{}",
- self.palette
- .hint(format_args!("Update with {}=overwrite", action_var))
- )
- .unwrap();
- }
- panic!("{}", buffer);
+ let message = if let Some(action_var) = self.action_var.as_deref() {
+ self.palette
+ .hint(format!("Update with {}=overwrite", action_var))
+ } else {
+ crate::report::Styled::new(String::new(), Default::default())
+ };
+ panic!("{err}{message}");
}
Action::Overwrite => {
use std::io::Write;
- let _ = writeln!(
- std::io::stderr(),
- "{}: {}",
- self.palette.warn("Fixing"),
- err
- );
+ let _ = writeln!(stderr(), "{}: {}", self.palette.warn("Fixing"), err);
actual.write_to(expected_path).unwrap();
}
}
@@ -415,20 +411,17 @@ impl Assert {
}
if ok {
use std::io::Write;
- let _ = write!(std::io::stderr(), "{}", buffer);
+ let _ = write!(stderr(), "{}", buffer);
match self.action {
Action::Skip => unreachable!("Bailed out earlier"),
Action::Ignore => {
- let _ = write!(
- std::io::stderr(),
- "{}",
- self.palette.warn("Ignoring above failures")
- );
+ let _ =
+ write!(stderr(), "{}", self.palette.warn("Ignoring above failures"));
}
Action::Verify => unreachable!("Something had to fail to get here"),
Action::Overwrite => {
let _ = write!(
- std::io::stderr(),
+ stderr(),
"{}",
self.palette.warn("Overwrote above failures")
);
@@ -519,7 +512,7 @@ impl Default for Assert {
action_var: Default::default(),
normalize_paths: true,
substitutions: Default::default(),
- palette: crate::report::Palette::auto(),
+ palette: crate::report::Palette::color(),
data_format: Default::default(),
}
.substitutions(crate::Substitutions::with_exe())
diff --git a/vendor/snapbox/src/cmd.rs b/vendor/snapbox/src/cmd.rs
index 72de3563c..8529852f9 100644
--- a/vendor/snapbox/src/cmd.rs
+++ b/vendor/snapbox/src/cmd.rs
@@ -1,5 +1,8 @@
//! Run commands and assert on their behavior
+#[cfg(feature = "color")]
+use anstream::panic;
+
/// Process spawning for testing of non-interactive commands
#[derive(Debug)]
pub struct Command {
@@ -923,10 +926,9 @@ pub fn display_exit_status(status: std::process::ExitStatus) -> String {
#[cfg(windows)]
fn detailed_exit_status(status: std::process::ExitStatus) -> Option<String> {
- use winapi::shared::minwindef::DWORD;
- use winapi::um::winnt::*;
+ use windows_sys::Win32::Foundation::*;
- let extra = match status.code().unwrap() as DWORD {
+ let extra = match status.code().unwrap() as NTSTATUS {
STATUS_ACCESS_VIOLATION => "STATUS_ACCESS_VIOLATION",
STATUS_IN_PAGE_ERROR => "STATUS_IN_PAGE_ERROR",
STATUS_INVALID_HANDLE => "STATUS_INVALID_HANDLE",
@@ -1028,3 +1030,141 @@ fn target_dir() -> std::path::PathBuf {
})
.unwrap()
}
+
+#[cfg(feature = "examples")]
+pub use examples::{compile_example, compile_examples};
+
+#[cfg(feature = "examples")]
+pub(crate) mod examples {
+ /// Prepare an example for testing
+ ///
+ /// Unlike `cargo_bin!`, this does not inherit all of the current compiler settings. It
+ /// will match the current target and profile but will not get feature flags. Pass those arguments
+ /// to the compiler via `args`.
+ ///
+ /// ## Example
+ ///
+ /// ```rust,no_run
+ /// snapbox::cmd::compile_example("snap-example-fixture", []);
+ /// ```
+ #[cfg(feature = "examples")]
+ pub fn compile_example<'a>(
+ target_name: &str,
+ args: impl IntoIterator<Item = &'a str>,
+ ) -> Result<std::path::PathBuf, crate::Error> {
+ crate::debug!("Compiling example {}", target_name);
+ let messages = escargot::CargoBuild::new()
+ .current_target()
+ .current_release()
+ .example(target_name)
+ .args(args)
+ .exec()
+ .map_err(|e| crate::Error::new(e.to_string()))?;
+ for message in messages {
+ let message = message.map_err(|e| crate::Error::new(e.to_string()))?;
+ let message = message
+ .decode()
+ .map_err(|e| crate::Error::new(e.to_string()))?;
+ crate::debug!("Message: {:?}", message);
+ if let Some(bin) = decode_example_message(&message) {
+ let (name, bin) = bin?;
+ assert_eq!(target_name, name);
+ return bin;
+ }
+ }
+
+ Err(crate::Error::new(format!(
+ "Unknown error building example {}",
+ target_name
+ )))
+ }
+
+ /// Prepare all examples for testing
+ ///
+ /// Unlike `cargo_bin!`, this does not inherit all of the current compiler settings. It
+ /// will match the current target and profile but will not get feature flags. Pass those arguments
+ /// to the compiler via `args`.
+ ///
+ /// ## Example
+ ///
+ /// ```rust,no_run
+ /// let examples = snapbox::cmd::compile_examples([]).unwrap().collect::<Vec<_>>();
+ /// ```
+ #[cfg(feature = "examples")]
+ pub fn compile_examples<'a>(
+ args: impl IntoIterator<Item = &'a str>,
+ ) -> Result<
+ impl Iterator<Item = (String, Result<std::path::PathBuf, crate::Error>)>,
+ crate::Error,
+ > {
+ crate::debug!("Compiling examples");
+ let mut examples = std::collections::BTreeMap::new();
+
+ let messages = escargot::CargoBuild::new()
+ .current_target()
+ .current_release()
+ .examples()
+ .args(args)
+ .exec()
+ .map_err(|e| crate::Error::new(e.to_string()))?;
+ for message in messages {
+ let message = message.map_err(|e| crate::Error::new(e.to_string()))?;
+ let message = message
+ .decode()
+ .map_err(|e| crate::Error::new(e.to_string()))?;
+ crate::debug!("Message: {:?}", message);
+ if let Some(bin) = decode_example_message(&message) {
+ let (name, bin) = bin?;
+ examples.insert(name.to_owned(), bin);
+ }
+ }
+
+ Ok(examples.into_iter())
+ }
+
+ #[allow(clippy::type_complexity)]
+ fn decode_example_message<'m>(
+ message: &'m escargot::format::Message,
+ ) -> Option<Result<(&'m str, Result<std::path::PathBuf, crate::Error>), crate::Error>> {
+ match message {
+ escargot::format::Message::CompilerMessage(msg) => {
+ let level = msg.message.level;
+ if level == escargot::format::diagnostic::DiagnosticLevel::Ice
+ || level == escargot::format::diagnostic::DiagnosticLevel::Error
+ {
+ let output = msg
+ .message
+ .rendered
+ .as_deref()
+ .unwrap_or_else(|| msg.message.message.as_ref())
+ .to_owned();
+ if is_example_target(&msg.target) {
+ let bin = Err(crate::Error::new(output));
+ Some(Ok((msg.target.name.as_ref(), bin)))
+ } else {
+ Some(Err(crate::Error::new(output)))
+ }
+ } else {
+ None
+ }
+ }
+ escargot::format::Message::CompilerArtifact(artifact) => {
+ if !artifact.profile.test && is_example_target(&artifact.target) {
+ let path = artifact
+ .executable
+ .clone()
+ .expect("cargo is new enough for this to be present");
+ let bin = Ok(path.into_owned());
+ Some(Ok((artifact.target.name.as_ref(), bin)))
+ } else {
+ None
+ }
+ }
+ _ => None,
+ }
+ }
+
+ fn is_example_target(target: &escargot::format::Target) -> bool {
+ target.crate_types == ["bin"] && target.kind == ["example"]
+ }
+}
diff --git a/vendor/snapbox/src/harness.rs b/vendor/snapbox/src/harness.rs
index ee1035aaa..77e085ebc 100644
--- a/vendor/snapbox/src/harness.rs
+++ b/vendor/snapbox/src/harness.rs
@@ -99,7 +99,7 @@ where
overrides
.matched(&path, is_dir)
.is_whitelist()
- .then(|| path)
+ .then_some(path)
} else {
Some(path)
}
@@ -114,6 +114,7 @@ where
let actual = (test)(&case.fixture)?;
let actual = actual.to_string();
let actual = crate::Data::text(actual).normalize(NormalizeNewlines);
+ #[allow(deprecated)]
let verify = Verifier::new()
.palette(crate::report::Palette::auto())
.action(self.action);
@@ -199,6 +200,7 @@ impl Verifier {
impl Default for Verifier {
fn default() -> Self {
Self {
+ #[allow(deprecated)]
palette: crate::report::Palette::auto(),
action: Action::Verify,
}
diff --git a/vendor/snapbox/src/path.rs b/vendor/snapbox/src/path.rs
index 16e4ef653..9cd1e3f94 100644
--- a/vendor/snapbox/src/path.rs
+++ b/vendor/snapbox/src/path.rs
@@ -1,5 +1,6 @@
//! Initialize working directories and assert on how they've changed
+#[cfg(feature = "path")]
use crate::data::{NormalizeMatches, NormalizeNewlines, NormalizePaths};
/// Working directory for tests
#[derive(Debug)]
diff --git a/vendor/snapbox/src/report/color.rs b/vendor/snapbox/src/report/color.rs
index f1cd363b4..1b74a3c58 100644
--- a/vendor/snapbox/src/report/color.rs
+++ b/vendor/snapbox/src/report/color.rs
@@ -1,127 +1,111 @@
-#[derive(Copy, Clone, Debug)]
-#[allow(dead_code)]
+#[derive(Copy, Clone, Debug, Default)]
pub struct Palette {
- pub(crate) info: styled::Style,
- pub(crate) warn: styled::Style,
- pub(crate) error: styled::Style,
- pub(crate) hint: styled::Style,
- pub(crate) expected: styled::Style,
- pub(crate) actual: styled::Style,
+ pub(crate) info: anstyle::Style,
+ pub(crate) warn: anstyle::Style,
+ pub(crate) error: anstyle::Style,
+ pub(crate) hint: anstyle::Style,
+ pub(crate) expected: anstyle::Style,
+ pub(crate) actual: anstyle::Style,
}
impl Palette {
- #[cfg(feature = "color")]
- pub fn always() -> Self {
- Self {
- info: styled::Style(yansi::Style::new(yansi::Color::Green)),
- warn: styled::Style(yansi::Style::new(yansi::Color::Yellow)),
- error: styled::Style(yansi::Style::new(yansi::Color::Red)),
- hint: styled::Style(yansi::Style::new(yansi::Color::Unset).dimmed()),
- expected: styled::Style(yansi::Style::new(yansi::Color::Green).underline()),
- actual: styled::Style(yansi::Style::new(yansi::Color::Red).underline()),
+ pub fn color() -> Self {
+ if cfg!(feature = "color") {
+ Self {
+ info: anstyle::AnsiColor::Green.into(),
+ warn: anstyle::AnsiColor::Yellow.into(),
+ error: anstyle::AnsiColor::Red.into(),
+ hint: anstyle::Effects::DIMMED.into(),
+ expected: anstyle::AnsiColor::Green | anstyle::Effects::UNDERLINE,
+ actual: anstyle::AnsiColor::Red | anstyle::Effects::UNDERLINE,
+ }
+ } else {
+ Self::plain()
}
}
- #[cfg(not(feature = "color"))]
+ pub fn plain() -> Self {
+ Self::default()
+ }
+
+ #[deprecated(since = "0.4.9", note = "Renamed to `Palette::color")]
pub fn always() -> Self {
- Self::never()
+ Self::color()
}
+ #[deprecated(since = "0.4.9", note = "Renamed to `Palette::plain")]
pub fn never() -> Self {
- Self {
- info: Default::default(),
- warn: Default::default(),
- error: Default::default(),
- hint: Default::default(),
- expected: Default::default(),
- actual: Default::default(),
- }
+ Self::plain()
}
+ #[deprecated(
+ since = "0.4.9",
+ note = "Use `Palette::always`, `auto` behavior is now implicit"
+ )]
pub fn auto() -> Self {
if is_colored() {
- Self::always()
+ Self::color()
} else {
- Self::never()
+ Self::plain()
}
}
pub fn info<D: std::fmt::Display>(self, item: D) -> Styled<D> {
- self.info.paint(item)
+ Styled::new(item, self.info)
}
pub fn warn<D: std::fmt::Display>(self, item: D) -> Styled<D> {
- self.warn.paint(item)
+ Styled::new(item, self.warn)
}
pub fn error<D: std::fmt::Display>(self, item: D) -> Styled<D> {
- self.error.paint(item)
+ Styled::new(item, self.error)
}
pub fn hint<D: std::fmt::Display>(self, item: D) -> Styled<D> {
- self.hint.paint(item)
+ Styled::new(item, self.hint)
}
pub fn expected<D: std::fmt::Display>(self, item: D) -> Styled<D> {
- self.expected.paint(item)
+ Styled::new(item, self.expected)
}
pub fn actual<D: std::fmt::Display>(self, item: D) -> Styled<D> {
- self.actual.paint(item)
+ Styled::new(item, self.actual)
}
}
fn is_colored() -> bool {
#[cfg(feature = "color")]
{
- concolor::get(concolor::Stream::Either).ansi_color()
+ anstream::AutoStream::choice(&std::io::stderr()) != anstream::ColorChoice::Never
}
-
#[cfg(not(feature = "color"))]
{
false
}
}
-pub(crate) use styled::Style;
-pub use styled::Styled;
-
-#[cfg(feature = "color")]
-mod styled {
- #[derive(Copy, Clone, Debug, Default)]
- pub(crate) struct Style(pub(crate) yansi::Style);
-
- impl Style {
- pub(crate) fn paint<T: std::fmt::Display>(self, item: T) -> Styled<T> {
- Styled(self.0.paint(item))
- }
- }
-
- pub struct Styled<D: std::fmt::Display>(yansi::Paint<D>);
+pub(crate) use anstyle::Style;
- impl<D: std::fmt::Display> std::fmt::Display for Styled<D> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- self.0.fmt(f)
- }
- }
+#[derive(Debug)]
+pub struct Styled<D> {
+ display: D,
+ style: anstyle::Style,
}
-#[cfg(not(feature = "color"))]
-mod styled {
- #[derive(Copy, Clone, Debug, Default)]
- pub(crate) struct Style;
-
- impl Style {
- pub(crate) fn paint<T: std::fmt::Display>(self, item: T) -> Styled<T> {
- Styled(item)
- }
+impl<D: std::fmt::Display> Styled<D> {
+ pub(crate) fn new(display: D, style: anstyle::Style) -> Self {
+ Self { display, style }
}
+}
- pub struct Styled<D: std::fmt::Display>(D);
-
- impl<D: std::fmt::Display> std::fmt::Display for Styled<D> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- self.0.fmt(f)
- }
+impl<D: std::fmt::Display> std::fmt::Display for Styled<D> {
+ #[inline]
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{}", self.style.render())?;
+ self.display.fmt(f)?;
+ write!(f, "{}", self.style.render_reset())?;
+ Ok(())
}
}
diff --git a/vendor/snapbox/src/report/diff.rs b/vendor/snapbox/src/report/diff.rs
index adc9f7935..67f6810b5 100644
--- a/vendor/snapbox/src/report/diff.rs
+++ b/vendor/snapbox/src/report/diff.rs
@@ -1,3 +1,5 @@
+use crate::report::Styled;
+
pub fn write_diff(
writer: &mut dyn std::fmt::Write,
expected: &crate::Data,
@@ -169,13 +171,13 @@ fn write_change(
} else {
write!(writer, "{:>4} ", " ",)?;
}
- write!(writer, "{} ", style.paint(sign))?;
+ write!(writer, "{} ", Styled::new(sign, style))?;
for &(emphasized, change) in change.values() {
let cur_style = if emphasized { em_style } else { style };
- write!(writer, "{}", cur_style.paint(change))?;
+ write!(writer, "{}", Styled::new(change, cur_style))?;
}
if change.missing_newline() {
- writeln!(writer, "{}", em_style.paint("∅"))?;
+ writeln!(writer, "{}", Styled::new("∅", em_style))?;
}
Ok(())
@@ -192,7 +194,7 @@ mod test {
let expected_name = "A";
let actual = "Hello\nWorld\n";
let actual_name = "B";
- let palette = crate::report::Palette::never();
+ let palette = crate::report::Palette::plain();
let mut actual_diff = String::new();
write_diff_inner(
@@ -221,7 +223,7 @@ mod test {
let expected_name = "A";
let actual = "Hello\n";
let actual_name = "B";
- let palette = crate::report::Palette::never();
+ let palette = crate::report::Palette::plain();
let mut actual_diff = String::new();
write_diff_inner(
@@ -250,7 +252,7 @@ mod test {
let expected_name = "A";
let actual = "Hello\nWorld\n";
let actual_name = "B";
- let palette = crate::report::Palette::never();
+ let palette = crate::report::Palette::plain();
let mut actual_diff = String::new();
write_diff_inner(
@@ -280,7 +282,7 @@ mod test {
let expected_name = "A";
let actual = "Hello\nWorld";
let actual_name = "B";
- let palette = crate::report::Palette::never();
+ let palette = crate::report::Palette::plain();
let mut actual_diff = String::new();
write_diff_inner(
@@ -334,7 +336,7 @@ mod test {
actual.push_str("?\n");
let actual_name = "B";
- let palette = crate::report::Palette::never();
+ let palette = crate::report::Palette::plain();
let mut actual_diff = String::new();
write_diff_inner(