summaryrefslogtreecommitdiffstats
path: root/third_party/rust/uuid/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/uuid/tests
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/uuid/tests')
-rw-r--r--third_party/rust/uuid/tests/macros.rs11
-rw-r--r--third_party/rust/uuid/tests/ui/compile_fail/invalid_parse.rs45
-rw-r--r--third_party/rust/uuid/tests/ui/compile_fail/invalid_parse.stderr197
-rw-r--r--third_party/rust/uuid/tests/ui/compile_pass/renamed.rs11
-rw-r--r--third_party/rust/uuid/tests/ui/compile_pass/valid.rs20
5 files changed, 284 insertions, 0 deletions
diff --git a/third_party/rust/uuid/tests/macros.rs b/third_party/rust/uuid/tests/macros.rs
new file mode 100644
index 0000000000..c7cf2a4298
--- /dev/null
+++ b/third_party/rust/uuid/tests/macros.rs
@@ -0,0 +1,11 @@
+#[cfg(feature = "macro-diagnostics")]
+#[test]
+fn ui() {
+ let t = trybuild::TestCases::new();
+
+ t.pass("tests/ui/compile_pass/*.rs");
+
+ if rustversion::cfg!(nightly) {
+ t.compile_fail("tests/ui/compile_fail/*.rs");
+ }
+}
diff --git a/third_party/rust/uuid/tests/ui/compile_fail/invalid_parse.rs b/third_party/rust/uuid/tests/ui/compile_fail/invalid_parse.rs
new file mode 100644
index 0000000000..f67456b935
--- /dev/null
+++ b/third_party/rust/uuid/tests/ui/compile_fail/invalid_parse.rs
@@ -0,0 +1,45 @@
+use uuid::{uuid, Uuid};
+
+const _: Uuid = uuid!("");
+const _: Uuid = uuid!("!");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BF-329BF39FA1E45");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-BBF-329BF39FA1E4");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-BGBF-329BF39FA1E4");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BFF329BF39FA1E4");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faaXB6BFF329BF39FA1E4");
+const _: Uuid = uuid!("F9168C5E-CEB-24fa-eB6BFF32-BF39FA1E4");
+const _: Uuid = uuid!("01020304-1112-2122-3132-41424344");
+const _: Uuid = uuid!("67e5504410b1426f9247bb680e5fe0c88");
+const _: Uuid = uuid!("67e5504410b1426f9247bb680e5fe0cg8");
+const _: Uuid = uuid!("urn:uuid:67e55044-10b1-426f-9247-bb680e5fe0c8");
+
+// Test error reporting
+const _: Uuid = uuid!("67e5504410b1426f9247bb680e5fe0c");
+const _: Uuid = uuid!("67e550X410b1426f9247bb680e5fe0cd");
+const _: Uuid = uuid!("67e550-4105b1426f9247bb680e5fe0c");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BF1-02BF39FA1E4");
+
+
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-BBF-329BF39FA1E4");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-BGBF-329BF39FA1E4");
+const _: Uuid = uuid!("01020304-1112-2122-3132-41424344");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BFF329BF39FA1E4");
+const _: Uuid = uuid!("urn:uuid:F9168C5E-CEB2-4faa-BGBF-329BF39FA1E4");
+const _: Uuid = uuid!("urn:uuid:F9168C5E-CEB2-4faa-B2cBF-32BF39FA1E4");
+const _: Uuid = uuid!("{F9168C5E-CEB2-4faa-B0a75-32BF39FA1E4}");
+
+const _: Uuid = uuid!("{F9168C5E-CEB2-4faa-B6BF-329Bz39FA1E4}");
+
+// group 0 has invalid length
+const _: Uuid = uuid!("67e550-4105b1426f9247bb680e5fe0c");
+
+const _: Uuid = uuid!("504410岡林aab1426f9247bb680e5fe0c8");
+const _: Uuid = uuid!("504410😎👍aab1426f9247bb680e5fe0c8");
+
+const _: Uuid = uuid!("{F9168C5E-CEB2-4faa-👍5-32BF39FA1E4}");
+
+const _: Uuid = uuid!("F916");
+const _: Uuid = uuid!("F916x");
+
+fn main() {}
diff --git a/third_party/rust/uuid/tests/ui/compile_fail/invalid_parse.stderr b/third_party/rust/uuid/tests/ui/compile_fail/invalid_parse.stderr
new file mode 100644
index 0000000000..b630494975
--- /dev/null
+++ b/third_party/rust/uuid/tests/ui/compile_fail/invalid_parse.stderr
@@ -0,0 +1,197 @@
+error: invalid length: expected length 32 for simple format, found 0
+ --> tests/ui/compile_fail/invalid_parse.rs:3:17
+ |
+3 | const _: Uuid = uuid!("");
+ | ^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `!` at 1
+ --> tests/ui/compile_fail/invalid_parse.rs:4:24
+ |
+4 | const _: Uuid = uuid!("!");
+ | ^
+
+error: invalid group length in group 4: expected 12, found 13
+ --> tests/ui/compile_fail/invalid_parse.rs:5:48
+ |
+5 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BF-329BF39FA1E45");
+ | ^^^^^^^^^^^^^
+
+error: invalid group length in group 3: expected 4, found 3
+ --> tests/ui/compile_fail/invalid_parse.rs:6:43
+ |
+6 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa-BBF-329BF39FA1E4");
+ | ^^^
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `G` at 21
+ --> tests/ui/compile_fail/invalid_parse.rs:7:44
+ |
+7 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa-BGBF-329BF39FA1E4");
+ | ^
+
+error: invalid group count: expected 5, found 4
+ --> tests/ui/compile_fail/invalid_parse.rs:8:17
+ |
+8 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BFF329BF39FA1E4");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid group count: expected 5, found 3
+ --> tests/ui/compile_fail/invalid_parse.rs:9:17
+ |
+9 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `X` at 19
+ --> tests/ui/compile_fail/invalid_parse.rs:10:42
+ |
+10 | const _: Uuid = uuid!("F9168C5E-CEB2-4faaXB6BFF329BF39FA1E4");
+ | ^
+
+error: invalid group length in group 1: expected 4, found 3
+ --> tests/ui/compile_fail/invalid_parse.rs:11:33
+ |
+11 | const _: Uuid = uuid!("F9168C5E-CEB-24fa-eB6BFF32-BF39FA1E4");
+ | ^^^
+
+error: invalid group length in group 4: expected 12, found 8
+ --> tests/ui/compile_fail/invalid_parse.rs:12:48
+ |
+12 | const _: Uuid = uuid!("01020304-1112-2122-3132-41424344");
+ | ^^^^^^^^
+
+error: invalid length: expected length 32 for simple format, found 33
+ --> tests/ui/compile_fail/invalid_parse.rs:13:17
+ |
+13 | const _: Uuid = uuid!("67e5504410b1426f9247bb680e5fe0c88");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `g` at 32
+ --> tests/ui/compile_fail/invalid_parse.rs:14:55
+ |
+14 | const _: Uuid = uuid!("67e5504410b1426f9247bb680e5fe0cg8");
+ | ^
+
+error: invalid length: expected length 32 for simple format, found 31
+ --> tests/ui/compile_fail/invalid_parse.rs:18:17
+ |
+18 | const _: Uuid = uuid!("67e5504410b1426f9247bb680e5fe0c");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `X` at 7
+ --> tests/ui/compile_fail/invalid_parse.rs:19:30
+ |
+19 | const _: Uuid = uuid!("67e550X410b1426f9247bb680e5fe0cd");
+ | ^
+
+error: invalid group count: expected 5, found 2
+ --> tests/ui/compile_fail/invalid_parse.rs:20:17
+ |
+20 | const _: Uuid = uuid!("67e550-4105b1426f9247bb680e5fe0c");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid group length in group 3: expected 4, found 5
+ --> tests/ui/compile_fail/invalid_parse.rs:21:43
+ |
+21 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BF1-02BF39FA1E4");
+ | ^^^^^
+
+error: invalid group length in group 3: expected 4, found 3
+ --> tests/ui/compile_fail/invalid_parse.rs:24:43
+ |
+24 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa-BBF-329BF39FA1E4");
+ | ^^^
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `G` at 21
+ --> tests/ui/compile_fail/invalid_parse.rs:25:44
+ |
+25 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa-BGBF-329BF39FA1E4");
+ | ^
+
+error: invalid group length in group 4: expected 12, found 8
+ --> tests/ui/compile_fail/invalid_parse.rs:26:48
+ |
+26 | const _: Uuid = uuid!("01020304-1112-2122-3132-41424344");
+ | ^^^^^^^^
+
+error: invalid group count: expected 5, found 4
+ --> tests/ui/compile_fail/invalid_parse.rs:27:17
+ |
+27 | const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BFF329BF39FA1E4");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `G` at 30
+ --> tests/ui/compile_fail/invalid_parse.rs:28:53
+ |
+28 | const _: Uuid = uuid!("urn:uuid:F9168C5E-CEB2-4faa-BGBF-329BF39FA1E4");
+ | ^
+
+error: invalid group length in group 3: expected 4, found 5
+ --> tests/ui/compile_fail/invalid_parse.rs:29:52
+ |
+29 | const _: Uuid = uuid!("urn:uuid:F9168C5E-CEB2-4faa-B2cBF-32BF39FA1E4");
+ | ^^^^^
+
+error: invalid group length in group 3: expected 4, found 5
+ --> tests/ui/compile_fail/invalid_parse.rs:30:44
+ |
+30 | const _: Uuid = uuid!("{F9168C5E-CEB2-4faa-B0a75-32BF39FA1E4}");
+ | ^^^^^
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `z` at 30
+ --> tests/ui/compile_fail/invalid_parse.rs:32:53
+ |
+32 | const _: Uuid = uuid!("{F9168C5E-CEB2-4faa-B6BF-329Bz39FA1E4}");
+ | ^
+
+error: invalid group count: expected 5, found 2
+ --> tests/ui/compile_fail/invalid_parse.rs:35:17
+ |
+35 | const _: Uuid = uuid!("67e550-4105b1426f9247bb680e5fe0c");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `岡` at 7
+ --> tests/ui/compile_fail/invalid_parse.rs:37:30
+ |
+37 | const _: Uuid = uuid!("504410岡林aab1426f9247bb680e5fe0c8");
+ | ^^
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `😎` at 7
+ --> tests/ui/compile_fail/invalid_parse.rs:38:30
+ |
+38 | const _: Uuid = uuid!("504410😎👍aab1426f9247bb680e5fe0c8");
+ | ^^
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `👍` at 21
+ --> tests/ui/compile_fail/invalid_parse.rs:40:44
+ |
+40 | const _: Uuid = uuid!("{F9168C5E-CEB2-4faa-👍5-32BF39FA1E4}");
+ | ^^
+
+error: invalid length: expected length 32 for simple format, found 4
+ --> tests/ui/compile_fail/invalid_parse.rs:42:17
+ |
+42 | const _: Uuid = uuid!("F916");
+ | ^^^^^^^^^^^^^
+ |
+ = note: this error originates in the macro `uuid` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-zA-Z], found `x` at 5
+ --> tests/ui/compile_fail/invalid_parse.rs:43:28
+ |
+43 | const _: Uuid = uuid!("F916x");
+ | ^
diff --git a/third_party/rust/uuid/tests/ui/compile_pass/renamed.rs b/third_party/rust/uuid/tests/ui/compile_pass/renamed.rs
new file mode 100644
index 0000000000..321172efef
--- /dev/null
+++ b/third_party/rust/uuid/tests/ui/compile_pass/renamed.rs
@@ -0,0 +1,11 @@
+use ::uuid::{uuid as id, Uuid as Id};
+
+mod uuid {
+ struct MyType;
+}
+
+struct Uuid;
+
+const _: Id = id!("67e55044-10b1-426f-9247-bb680e5fe0c8");
+
+fn main() {}
diff --git a/third_party/rust/uuid/tests/ui/compile_pass/valid.rs b/third_party/rust/uuid/tests/ui/compile_pass/valid.rs
new file mode 100644
index 0000000000..1f536dc043
--- /dev/null
+++ b/third_party/rust/uuid/tests/ui/compile_pass/valid.rs
@@ -0,0 +1,20 @@
+use uuid::{uuid, Uuid};
+
+const _: Uuid = uuid!("00000000000000000000000000000000");
+const _: Uuid = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8");
+const _: Uuid = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8");
+const _: Uuid = uuid!("F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4");
+const _: Uuid = uuid!("67e5504410b1426f9247bb680e5fe0c8");
+const _: Uuid = uuid!("01020304-1112-2122-3132-414243444546");
+const _: Uuid = uuid!("urn:uuid:67e55044-10b1-426f-9247-bb680e5fe0c8");
+
+// Nil
+const _: Uuid = uuid!("00000000000000000000000000000000");
+const _: Uuid = uuid!("00000000-0000-0000-0000-000000000000");
+
+// valid hyphenated
+const _: Uuid = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8");
+// valid short
+const _: Uuid = uuid!("67e5504410b1426f9247bb680e5fe0c8");
+
+fn main() {}