]> git.lizzy.rs Git - rust.git/commitdiff
Add a test for unit test of `proc-macro` crate
authorhyd-dev <yd-huang@outlook.com>
Mon, 18 Jan 2021 16:26:15 +0000 (00:26 +0800)
committerhyd-dev <yd-huang@outlook.com>
Sun, 24 Jan 2021 15:48:17 +0000 (23:48 +0800)
test-cargo-miri/run-test.py
test-cargo-miri/subcrate/Cargo.toml
test-cargo-miri/subcrate/src/lib.rs [new file with mode: 0644]
test-cargo-miri/test.stderr-proc-macro.ref [new file with mode: 0644]

index 60924d4f8ddcaaeb50f0041b882c3ca85cbc734a..8edd947c3b0faf3a38546303d1bd43e9cb6e97c9 100755 (executable)
@@ -102,7 +102,7 @@ def test_cargo_miri_test():
     )
     test("`cargo miri test` (subcrate, no isolation)",
         cargo_miri("test") + ["-p", "subcrate"],
-        "test.subcrate.stdout.ref", "test.stderr-empty.ref",
+        "test.subcrate.stdout.ref", "test.stderr-proc-macro.ref",
         env={'MIRIFLAGS': "-Zmiri-disable-isolation"},
     )
 
index be27f88ad9a1cfbd1a7bdd90b6a12a065e72f370..ea2936d52a054aaafae549958dd2a0d7935fdeef 100644 (file)
@@ -4,6 +4,10 @@ version = "0.1.0"
 authors = ["Miri Team"]
 edition = "2018"
 
+[lib]
+proc-macro = true
+doctest = false
+
 [[bin]]
 name = "subcrate"
 path = "main.rs"
diff --git a/test-cargo-miri/subcrate/src/lib.rs b/test-cargo-miri/subcrate/src/lib.rs
new file mode 100644 (file)
index 0000000..706e368
--- /dev/null
@@ -0,0 +1,2 @@
+#[cfg(test)]
+compile_error!("Miri should not touch me");
diff --git a/test-cargo-miri/test.stderr-proc-macro.ref b/test-cargo-miri/test.stderr-proc-macro.ref
new file mode 100644 (file)
index 0000000..4983250
--- /dev/null
@@ -0,0 +1 @@
+Running unit tests of `proc-macro` crates is not currently supported by Miri.