summaryrefslogtreecommitdiffstats
path: root/vendor/maybe-async/tests/ui/test_fail
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/maybe-async/tests/ui/test_fail')
-rw-r--r--vendor/maybe-async/tests/ui/test_fail/01-empty-test.rs17
-rw-r--r--vendor/maybe-async/tests/ui/test_fail/01-empty-test.stderr7
-rw-r--r--vendor/maybe-async/tests/ui/test_fail/02-unknown-path.rs17
-rw-r--r--vendor/maybe-async/tests/ui/test_fail/02-unknown-path.stderr5
-rw-r--r--vendor/maybe-async/tests/ui/test_fail/03-async-gt2.rs16
-rw-r--r--vendor/maybe-async/tests/ui/test_fail/03-async-gt2.stderr5
-rw-r--r--vendor/maybe-async/tests/ui/test_fail/04-bad-sync-cond.rs17
-rw-r--r--vendor/maybe-async/tests/ui/test_fail/04-bad-sync-cond.stderr5
8 files changed, 89 insertions, 0 deletions
diff --git a/vendor/maybe-async/tests/ui/test_fail/01-empty-test.rs b/vendor/maybe-async/tests/ui/test_fail/01-empty-test.rs
new file mode 100644
index 000000000..f409e7334
--- /dev/null
+++ b/vendor/maybe-async/tests/ui/test_fail/01-empty-test.rs
@@ -0,0 +1,17 @@
+use maybe_async::maybe_async;
+
+#[maybe_async]
+async fn async_fn() -> bool {
+ true
+}
+
+// at least one sync condition should be specified
+#[maybe_async::test()]
+async fn test_async_fn() {
+ let res = async_fn().await;
+ assert_eq!(res, true);
+}
+
+fn main() {
+
+}
diff --git a/vendor/maybe-async/tests/ui/test_fail/01-empty-test.stderr b/vendor/maybe-async/tests/ui/test_fail/01-empty-test.stderr
new file mode 100644
index 000000000..b90d9ee35
--- /dev/null
+++ b/vendor/maybe-async/tests/ui/test_fail/01-empty-test.stderr
@@ -0,0 +1,7 @@
+error: Arguments cannot be empty, at least specify the condition for sync code
+ --> tests/ui/test_fail/01-empty-test.rs:9:1
+ |
+9 | #[maybe_async::test()]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the attribute macro `maybe_async::test` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/maybe-async/tests/ui/test_fail/02-unknown-path.rs b/vendor/maybe-async/tests/ui/test_fail/02-unknown-path.rs
new file mode 100644
index 000000000..7b79bd1f2
--- /dev/null
+++ b/vendor/maybe-async/tests/ui/test_fail/02-unknown-path.rs
@@ -0,0 +1,17 @@
+use maybe_async::maybe_async;
+
+#[maybe_async]
+async fn async_fn() -> bool {
+ true
+}
+
+// should only accept `async`
+#[maybe_async::test(feature="is_sync", unknown(not(feature="is_sync"), async_std::test))]
+async fn test_async_fn() {
+ let res = async_fn().await;
+ assert_eq!(res, true);
+}
+
+fn main() {
+
+}
diff --git a/vendor/maybe-async/tests/ui/test_fail/02-unknown-path.stderr b/vendor/maybe-async/tests/ui/test_fail/02-unknown-path.stderr
new file mode 100644
index 000000000..6a603c01d
--- /dev/null
+++ b/vendor/maybe-async/tests/ui/test_fail/02-unknown-path.stderr
@@ -0,0 +1,5 @@
+error: Unknown path: `unknown`, must be `async`
+ --> tests/ui/test_fail/02-unknown-path.rs:9:40
+ |
+9 | #[maybe_async::test(feature="is_sync", unknown(not(feature="is_sync"), async_std::test))]
+ | ^^^^^^^
diff --git a/vendor/maybe-async/tests/ui/test_fail/03-async-gt2.rs b/vendor/maybe-async/tests/ui/test_fail/03-async-gt2.rs
new file mode 100644
index 000000000..f7313bd52
--- /dev/null
+++ b/vendor/maybe-async/tests/ui/test_fail/03-async-gt2.rs
@@ -0,0 +1,16 @@
+use maybe_async::maybe_async;
+
+#[maybe_async]
+async fn async_fn() -> bool {
+ true
+}
+
+#[maybe_async::test(feature="is_sync", async(feature="async", async_std::test, added))]
+async fn test_async_fn() {
+ let res = async_fn().await;
+ assert_eq!(res, true);
+}
+
+fn main() {
+
+}
diff --git a/vendor/maybe-async/tests/ui/test_fail/03-async-gt2.stderr b/vendor/maybe-async/tests/ui/test_fail/03-async-gt2.stderr
new file mode 100644
index 000000000..8c051da85
--- /dev/null
+++ b/vendor/maybe-async/tests/ui/test_fail/03-async-gt2.stderr
@@ -0,0 +1,5 @@
+error: Must pass two metas or string literals like `async(condition, async_test_macro)`, you passed 3 metas.
+ --> tests/ui/test_fail/03-async-gt2.rs:8:40
+ |
+8 | #[maybe_async::test(feature="is_sync", async(feature="async", async_std::test, added))]
+ | ^^^^^
diff --git a/vendor/maybe-async/tests/ui/test_fail/04-bad-sync-cond.rs b/vendor/maybe-async/tests/ui/test_fail/04-bad-sync-cond.rs
new file mode 100644
index 000000000..f5ad658a4
--- /dev/null
+++ b/vendor/maybe-async/tests/ui/test_fail/04-bad-sync-cond.rs
@@ -0,0 +1,17 @@
+use maybe_async::maybe_async;
+
+#[maybe_async]
+async fn async_fn() -> bool {
+ true
+}
+
+// bad sync condition
+#[maybe_async::test(unknown(feature="async", async_std::test))]
+async fn test_async_fn() {
+ let res = async_fn().await;
+ assert_eq!(res, true);
+}
+
+fn main() {
+
+} \ No newline at end of file
diff --git a/vendor/maybe-async/tests/ui/test_fail/04-bad-sync-cond.stderr b/vendor/maybe-async/tests/ui/test_fail/04-bad-sync-cond.stderr
new file mode 100644
index 000000000..97294ffcc
--- /dev/null
+++ b/vendor/maybe-async/tests/ui/test_fail/04-bad-sync-cond.stderr
@@ -0,0 +1,5 @@
+error[E0537]: invalid predicate `unknown`
+ --> tests/ui/test_fail/04-bad-sync-cond.rs:9:21
+ |
+9 | #[maybe_async::test(unknown(feature="async", async_std::test))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^