Scaffold uitest

This commit is contained in:
Ayaz Hafiz 2023-03-31 12:47:13 -05:00
parent 58cef56a23
commit cf3fc7f4a8
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 309 additions and 39 deletions

193
Cargo.lock generated
View file

@ -232,6 +232,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "487f1e0fcbe47deb8b0574e646def1c903389d95241dd1bbcc6ce4a715dfc0c1"
[[package]] [[package]]
name = "bitmaps" name = "bitmaps"
version = "2.1.0" version = "2.1.0"
@ -420,7 +426,7 @@ version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"textwrap 0.11.0", "textwrap 0.11.0",
"unicode-width", "unicode-width",
] ]
@ -432,14 +438,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags 1.3.2",
"clap_lex", "clap_lex 0.2.4",
"indexmap", "indexmap",
"strsim", "strsim",
"termcolor", "termcolor",
"textwrap 0.16.0", "textwrap 0.16.0",
] ]
[[package]]
name = "clap"
version = "4.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42dfd32784433290c51d92c438bb72ea5063797fc3cc9a21a8c4346bebbb2098"
dependencies = [
"bitflags 2.0.2",
"clap_derive",
"clap_lex 0.3.3",
"is-terminal",
"once_cell",
"strsim",
"termcolor",
]
[[package]]
name = "clap_derive"
version = "4.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fddf67631444a3a3e3e5ac51c36a5e01335302de677bd78759eaa90ab1f46644"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.2.4" version = "0.2.4"
@ -449,6 +483,15 @@ dependencies = [
"os_str_bytes", "os_str_bytes",
] ]
[[package]]
name = "clap_lex"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646"
dependencies = [
"os_str_bytes",
]
[[package]] [[package]]
name = "cli_utils" name = "cli_utils"
version = "0.0.1" version = "0.0.1"
@ -493,7 +536,7 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"block", "block",
"cocoa-foundation", "cocoa-foundation",
"core-foundation 0.9.3", "core-foundation 0.9.3",
@ -509,7 +552,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"block", "block",
"core-foundation 0.9.3", "core-foundation 0.9.3",
"core-graphics-types", "core-graphics-types",
@ -656,7 +699,7 @@ version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"core-foundation 0.7.0", "core-foundation 0.7.0",
"foreign-types", "foreign-types",
"libc", "libc",
@ -668,7 +711,7 @@ version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"core-foundation 0.9.3", "core-foundation 0.9.3",
"core-graphics-types", "core-graphics-types",
"foreign-types", "foreign-types",
@ -681,7 +724,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"core-foundation 0.9.3", "core-foundation 0.9.3",
"foreign-types", "foreign-types",
"libc", "libc",
@ -881,7 +924,7 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2daefd788d1e96e0a9d66dee4b828b883509bc3ea9ce30665f04c3246372690c" checksum = "2daefd788d1e96e0a9d66dee4b828b883509bc3ea9ce30665f04c3246372690c"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"libloading", "libloading",
"winapi", "winapi",
] ]
@ -1134,7 +1177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ef1a30ae415c3a691a4f41afddc2dbcd6d70baf338368d85ebc1e8ed92cedb9" checksum = "8ef1a30ae415c3a691a4f41afddc2dbcd6d70baf338368d85ebc1e8ed92cedb9"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"rustix", "rustix 0.36.9",
"windows-sys 0.45.0", "windows-sys 0.45.0",
] ]
@ -1419,7 +1462,7 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d" checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"gpu-alloc-types", "gpu-alloc-types",
] ]
@ -1429,7 +1472,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -1438,7 +1481,7 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"gpu-descriptor-types", "gpu-descriptor-types",
"hashbrown 0.12.3", "hashbrown 0.12.3",
] ]
@ -1449,7 +1492,7 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -1520,6 +1563,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hermit-abi"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]] [[package]]
name = "hexf-parse" name = "hexf-parse"
version = "0.2.1" version = "0.2.1"
@ -1745,6 +1794,18 @@ version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
[[package]]
name = "is-terminal"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8"
dependencies = [
"hermit-abi 0.3.1",
"io-lifetimes",
"rustix 0.37.3",
"windows-sys 0.45.0",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.9.0" version = "0.9.0"
@ -1848,6 +1909,17 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "libtest-mimic"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7b603516767d1ab23d0de09d023e62966c3322f7148297c35cf3d97aa8b37fa"
dependencies = [
"clap 4.1.11",
"termcolor",
"threadpool",
]
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
version = "0.5.6" version = "0.5.6"
@ -1860,6 +1932,12 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]]
name = "linux-raw-sys"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
[[package]] [[package]]
name = "llvm-sys" name = "llvm-sys"
version = "130.0.7" version = "130.0.7"
@ -1898,7 +1976,7 @@ version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b6f2d7176b94027af58085a2c9d27c4e416586caba409c314569213901d6068" checksum = "8b6f2d7176b94027af58085a2c9d27c4e416586caba409c314569213901d6068"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"byteorder", "byteorder",
"lazy_static", "lazy_static",
"libc", "libc",
@ -1980,7 +2058,7 @@ version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0514f491f4cc03632ab399ee01e2c1c1b12d3e1cf2d667c1ff5f87d6dcd2084" checksum = "e0514f491f4cc03632ab399ee01e2c1c1b12d3e1cf2d667c1ff5f87d6dcd2084"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"block", "block",
"core-graphics-types", "core-graphics-types",
"foreign-types", "foreign-types",
@ -2048,7 +2126,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3012f2dbcc79e8e0b5825a4836a7106a75dd9b2fe42c528163be0f572538c705" checksum = "3012f2dbcc79e8e0b5825a4836a7106a75dd9b2fe42c528163be0f572538c705"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags 1.3.2",
"codespan-reporting", "codespan-reporting",
"hexf-parse", "hexf-parse",
"indexmap", "indexmap",
@ -2065,7 +2143,7 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d" checksum = "96d868f654c72e75f8687572699cdabe755f03effbb62542768e995d5b8d699d"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"jni-sys", "jni-sys",
"ndk-sys", "ndk-sys",
"num_enum", "num_enum",
@ -2127,7 +2205,7 @@ version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cc", "cc",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
@ -2140,7 +2218,7 @@ version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cc", "cc",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
@ -2153,7 +2231,7 @@ version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"memoffset 0.6.5", "memoffset 0.6.5",
@ -2165,7 +2243,7 @@ version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
"static_assertions", "static_assertions",
@ -2646,6 +2724,30 @@ dependencies = [
"toml_edit", "toml_edit",
] ]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.51" version = "1.0.51"
@ -2668,7 +2770,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70" checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags", "bitflags 1.3.2",
"byteorder", "byteorder",
"lazy_static", "lazy_static",
"num-traits", "num-traits",
@ -2688,7 +2790,7 @@ version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"memchr", "memchr",
"unicase", "unicase",
] ]
@ -2843,7 +2945,7 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -3817,6 +3919,7 @@ dependencies = [
"indoc", "indoc",
"insta", "insta",
"lazy_static", "lazy_static",
"libtest-mimic",
"pretty_assertions", "pretty_assertions",
"regex", "regex",
"roc_builtins", "roc_builtins",
@ -3915,7 +4018,7 @@ dependencies = [
name = "roc_unify" name = "roc_unify"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"roc_collections", "roc_collections",
"roc_debug_flags", "roc_debug_flags",
"roc_error_macros", "roc_error_macros",
@ -3971,11 +4074,25 @@ version = "0.36.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"errno 0.2.8", "errno 0.2.8",
"io-lifetimes", "io-lifetimes",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys 0.1.4",
"windows-sys 0.45.0",
]
[[package]]
name = "rustix"
version = "0.37.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b24138615de35e32031d041a09032ef3487a616d901ca4db224e7d557efae2"
dependencies = [
"bitflags 1.3.2",
"errno 0.3.0",
"io-lifetimes",
"libc",
"linux-raw-sys 0.3.1",
"windows-sys 0.45.0", "windows-sys 0.45.0",
] ]
@ -4023,7 +4140,7 @@ name = "rustyline"
version = "9.1.1" version = "9.1.1"
source = "git+https://github.com/roc-lang/rustyline?rev=e74333c#e74333c0d618896b88175bf06645108f996fe6d0" source = "git+https://github.com/roc-lang/rustyline?rev=e74333c#e74333c0d618896b88175bf06645108f996fe6d0"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"clipboard-win 4.5.0", "clipboard-win 4.5.0",
"dirs-next", "dirs-next",
@ -4315,7 +4432,7 @@ version = "0.15.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"calloop", "calloop",
"dlib", "dlib",
"lazy_static", "lazy_static",
@ -4334,7 +4451,7 @@ version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"dlib", "dlib",
"lazy_static", "lazy_static",
"log", "log",
@ -4401,7 +4518,7 @@ version = "0.2.0+1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"num-traits", "num-traits",
] ]
@ -5225,7 +5342,7 @@ version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"downcast-rs", "downcast-rs",
"libc", "libc",
"nix 0.24.3", "nix 0.24.3",
@ -5264,7 +5381,7 @@ version = "0.29.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"wayland-client", "wayland-client",
"wayland-commons", "wayland-commons",
"wayland-scanner", "wayland-scanner",
@ -5349,7 +5466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4688c000eb841ca55f7b35db659b78d6e1cd77d7caf8fb929f4e181f754047d" checksum = "c4688c000eb841ca55f7b35db659b78d6e1cd77d7caf8fb929f4e181f754047d"
dependencies = [ dependencies = [
"arrayvec 0.7.2", "arrayvec 0.7.2",
"bitflags", "bitflags 1.3.2",
"cfg_aliases", "cfg_aliases",
"codespan-reporting", "codespan-reporting",
"copyless", "copyless",
@ -5374,7 +5491,7 @@ dependencies = [
"arrayvec 0.7.2", "arrayvec 0.7.2",
"ash", "ash",
"bit-set", "bit-set",
"bitflags", "bitflags 1.3.2",
"block", "block",
"core-graphics-types", "core-graphics-types",
"d3d12", "d3d12",
@ -5409,7 +5526,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "549533d9e1cdd4b4cda7718d33ff500fc4c34b5467b71d76b547ae0324f3b2a2" checksum = "549533d9e1cdd4b4cda7718d33ff500fc4c34b5467b71d76b547ae0324f3b2a2"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -5551,7 +5668,7 @@ version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a" checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"cocoa", "cocoa",
"core-foundation 0.9.3", "core-foundation 0.9.3",
"core-graphics 0.22.3", "core-graphics 0.22.3",

View file

@ -112,6 +112,7 @@ lazy_static = "1.4.0"
libc = "0.2.139" # update roc_std/Cargo.toml on change libc = "0.2.139" # update roc_std/Cargo.toml on change
libfuzzer-sys = "0.4" libfuzzer-sys = "0.4"
libloading = "0.7.4" libloading = "0.7.4"
libtest-mimic = "0.6.0"
log = "0.4.17" log = "0.4.17"
mach_object = "0.1" mach_object = "0.1"
maplit = "1.0.2" maplit = "1.0.2"

View file

@ -49,3 +49,4 @@ lazy_static.workspace = true
pretty_assertions.workspace = true pretty_assertions.workspace = true
regex.workspace = true regex.workspace = true
tempfile.workspace = true tempfile.workspace = true
libtest-mimic.workspace = true

View file

@ -1 +1,152 @@
fn main() {} use std::{
error::Error,
ffi::OsStr,
fs, io,
path::{Path, PathBuf},
process::Command,
};
use lazy_static::lazy_static;
use libtest_mimic::{run, Arguments, Failed, Trial};
use regex::Regex;
use test_solve_helpers::InferOptions;
fn main() -> Result<(), Box<dyn Error>> {
let args = Arguments::from_args();
let test_files = collect_uitest_files()?;
let tests = test_files
.into_iter()
.map(into_test)
.collect::<Result<_, _>>()?;
run(&args, tests).exit()
}
lazy_static! {
static ref UITEST_PATH: PathBuf = PathBuf::from(std::env!("ROC_WORKSPACE_DIR"))
.join("crates")
.join("compiler")
.join("solve")
.join("tests")
.join("uitest");
/// # +opt infer:<opt>
static ref RE_OPT_INFER: Regex =
Regex::new(r#"# +opt infer:(?P<opt>.*)"#).unwrap();
}
fn collect_uitest_files() -> io::Result<Vec<PathBuf>> {
let mut tests = Vec::with_capacity(200);
let mut dirs_to_visit = vec![UITEST_PATH.clone()];
while let Some(dir) = dirs_to_visit.pop() {
for entry in fs::read_dir(dir)? {
let entry = entry?;
let path = entry.path();
let entry_type = entry.file_type()?;
if entry_type.is_dir() {
dirs_to_visit.push(path);
continue;
}
if path.extension() == Some(OsStr::new("txt")) {
tests.push(path);
}
}
}
Ok(tests)
}
fn into_test(path: PathBuf) -> io::Result<Trial> {
let name = path
.strip_prefix(UITEST_PATH.as_path().parent().unwrap())
.expect("collected path does not have uitest prefix")
.display()
.to_string();
let trial = Trial::test(name, move || run_test(path));
Ok(trial)
}
fn run_test(path: PathBuf) -> Result<(), Failed> {
let data = std::fs::read_to_string(&path)?;
let TestCase {
infer_options,
source,
} = TestCase::parse(data)?;
fs::write(&path, &source)?;
check_for_changes(&path)?;
Ok(())
}
const UITEST_HEADER: &str = "# uitest:";
struct TestCase {
infer_options: InferOptions,
source: String,
}
impl TestCase {
fn parse(mut data: String) -> Result<Self, Failed> {
// Drop anything following `# uitest:` header lines; that's the output.
if let Some(drop_at) = data.find(UITEST_HEADER) {
data.truncate(drop_at);
data.truncate(data.trim_end().len());
}
Ok(TestCase {
infer_options: Self::parse_infer_options(&data)?,
source: data,
})
}
fn parse_infer_options(data: &str) -> Result<InferOptions, Failed> {
let mut infer_opts = InferOptions::default();
let found_infer_opts = RE_OPT_INFER.captures_iter(data);
for infer_opt in found_infer_opts {
let opt = infer_opt.name("opt").unwrap().as_str();
match opt {
"allow_errors" => infer_opts.allow_errors = true,
"print_only_under_alias" => infer_opts.print_only_under_alias = true,
other => return Err(format!("unknown infer option: {other}").into()),
}
}
Ok(infer_opts)
}
}
fn check_for_changes(path: &Path) -> Result<(), Failed> {
let is_tracked = Command::new("git")
.args(["ls-files", "--error-unmatch"])
.arg(path)
.output()?;
if !is_tracked.status.success() {
return Err(format!(
"Test file {} is not tracked by git. Try using `git add` on it.",
path.display(),
)
.into());
}
let has_changes = Command::new("git")
.args(["diff", "--color=always"])
.arg(path)
.output()?;
if !has_changes.stdout.is_empty() {
return Err(format!(
"{}\nOutput has changed. If it looks okay, `git` add the file.",
std::str::from_utf8(&has_changes.stdout)?
)
.into());
}
Ok(())
}