Move, update identifier macro tests
This commit is contained in:
parent
9bc6ce9201
commit
a589e92144
@ -33,3 +33,4 @@ strum = { version = "0.18.0", features = ["derive"] }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
matches = "0.1.8"
|
matches = "0.1.8"
|
||||||
serde_json = "1.0.57"
|
serde_json = "1.0.57"
|
||||||
|
trybuild = "1.0.31"
|
||||||
|
12
ruma-identifiers/tests/ui/01-valid-id-macros.rs
Normal file
12
ruma-identifiers/tests/ui/01-valid-id-macros.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fn main() {
|
||||||
|
let _ = ruma_identifiers::device_key_id!("ed25519:JLAFKJWSCS");
|
||||||
|
let _ = ruma_identifiers::event_id!("$39hvsi03hlne:example.com");
|
||||||
|
let _ = ruma_identifiers::event_id!("$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk");
|
||||||
|
let _ = ruma_identifiers::room_alias_id!("#alias:server.tld");
|
||||||
|
let _ = ruma_identifiers::room_id!("!1234567890:matrix.org");
|
||||||
|
let _ = ruma_identifiers::room_version_id!("1");
|
||||||
|
let _ = ruma_identifiers::room_version_id!("1-custom");
|
||||||
|
let _ = ruma_identifiers::server_key_id!("ed25519:Abc_1");
|
||||||
|
let _ = ruma_identifiers::server_name!("myserver.fish");
|
||||||
|
let _ = ruma_identifiers::user_id!("@user:ruma.io");
|
||||||
|
}
|
11
ruma-identifiers/tests/ui/02-invalid-id-macros.rs
Normal file
11
ruma-identifiers/tests/ui/02-invalid-id-macros.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fn main() {
|
||||||
|
let _ = ruma_identifiers::device_key_id!("ed2519:JLAFKJWSCS");
|
||||||
|
let _ = ruma_identifiers::event_id!("39hvsi03hlne:example.com");
|
||||||
|
let _ = ruma_identifiers::event_id!("acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk");
|
||||||
|
let _ = ruma_identifiers::room_alias_id!("alias:server.tld");
|
||||||
|
let _ = ruma_identifiers::room_id!("1234567890:matrix.org");
|
||||||
|
let _ = ruma_identifiers::room_version_id!("");
|
||||||
|
let _ = ruma_identifiers::server_key_id!("ed219:Abc_1");
|
||||||
|
let _ = ruma_identifiers::server_name!("");
|
||||||
|
let _ = ruma_identifiers::user_id!("user:ruma.io");
|
||||||
|
}
|
80
ruma-identifiers/tests/ui/02-invalid-id-macros.stderr
Normal file
80
ruma-identifiers/tests/ui/02-invalid-id-macros.stderr
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:2:13
|
||||||
|
|
|
||||||
|
2 | let _ = ruma_identifiers::device_key_id!("ed2519:JLAFKJWSCS");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid device key id
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:3:13
|
||||||
|
|
|
||||||
|
3 | let _ = ruma_identifiers::event_id!("39hvsi03hlne:example.com");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid event id
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:4:13
|
||||||
|
|
|
||||||
|
4 | let _ = ruma_identifiers::event_id!("acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid event id
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:5:13
|
||||||
|
|
|
||||||
|
5 | let _ = ruma_identifiers::room_alias_id!("alias:server.tld");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid room_alias_id
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:6:13
|
||||||
|
|
|
||||||
|
6 | let _ = ruma_identifiers::room_id!("1234567890:matrix.org");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid room_id
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:7:13
|
||||||
|
|
|
||||||
|
7 | let _ = ruma_identifiers::room_version_id!("");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid room_version_id
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:8:13
|
||||||
|
|
|
||||||
|
8 | let _ = ruma_identifiers::server_key_id!("ed219:Abc_1");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid server_key_id
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:9:13
|
||||||
|
|
|
||||||
|
9 | let _ = ruma_identifiers::server_name!("");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid server_name
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: proc macro panicked
|
||||||
|
--> $DIR/02-invalid-id-macros.rs:10:13
|
||||||
|
|
|
||||||
|
10 | let _ = ruma_identifiers::user_id!("user:ruma.io");
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: message: Invalid user_id
|
||||||
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
@ -33,6 +33,3 @@ ruma-api = { version = "=0.17.0-alpha.1", path = "../ruma-api", optional = true
|
|||||||
ruma-appservice-api = { version = "=0.2.0-alpha.1", path = "../ruma-appservice-api", optional = true }
|
ruma-appservice-api = { version = "=0.2.0-alpha.1", path = "../ruma-appservice-api", optional = true }
|
||||||
ruma-client-api = { version = "=0.10.0-alpha.1", path = "../ruma-client-api", optional = true }
|
ruma-client-api = { version = "=0.10.0-alpha.1", path = "../ruma-client-api", optional = true }
|
||||||
ruma-federation-api = { version = "0.0.3", path = "../ruma-federation-api", optional = true }
|
ruma-federation-api = { version = "0.0.3", path = "../ruma-federation-api", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
trybuild = "1.0.30"
|
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
let _ = ruma::device_key_id!("ed25519:JLAFKJWSCS");
|
|
||||||
let _ = ruma::event_id!("$39hvsi03hlne:example.com");
|
|
||||||
let _ = ruma::event_id!("$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk");
|
|
||||||
let _ = ruma::room_alias_id!("#alias:server.tld");
|
|
||||||
let _ = ruma::room_id!("!1234567890:matrix.org");
|
|
||||||
let _ = ruma::room_version_id!("1");
|
|
||||||
let _ = ruma::room_version_id!("1-custom");
|
|
||||||
let _ = ruma::server_key_id!("ed25519:Abc_1");
|
|
||||||
let _ = ruma::server_name!("myserver.fish");
|
|
||||||
let _ = ruma::user_id!("@user:ruma.io");
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
let _ = ruma::device_key_id!("ed2519:JLAFKJWSCS");
|
|
||||||
let _ = ruma::event_id!("39hvsi03hlne:example.com");
|
|
||||||
let _ = ruma::event_id!("acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk");
|
|
||||||
let _ = ruma::room_alias_id!("alias:server.tld");
|
|
||||||
let _ = ruma::room_id!("1234567890:matrix.org");
|
|
||||||
let _ = ruma::room_version_id!("");
|
|
||||||
let _ = ruma::server_key_id!("ed219:Abc_1");
|
|
||||||
let _ = ruma::server_name!("");
|
|
||||||
let _ = ruma::user_id!("user:ruma.io");
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:2:13
|
|
||||||
|
|
|
||||||
2 | let _ = ruma::device_key_id!("ed2519:JLAFKJWSCS");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid device key id
|
|
||||||
|
|
||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:3:13
|
|
||||||
|
|
|
||||||
3 | let _ = ruma::event_id!("39hvsi03hlne:example.com");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid event id
|
|
||||||
|
|
||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:4:13
|
|
||||||
|
|
|
||||||
4 | let _ = ruma::event_id!("acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid event id
|
|
||||||
|
|
||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:5:13
|
|
||||||
|
|
|
||||||
5 | let _ = ruma::room_alias_id!("alias:server.tld");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid room_alias_id
|
|
||||||
|
|
||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:6:13
|
|
||||||
|
|
|
||||||
6 | let _ = ruma::room_id!("1234567890:matrix.org");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid room_id
|
|
||||||
|
|
||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:7:13
|
|
||||||
|
|
|
||||||
7 | let _ = ruma::room_version_id!("");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid room_version_id
|
|
||||||
|
|
||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:8:13
|
|
||||||
|
|
|
||||||
8 | let _ = ruma::server_key_id!("ed219:Abc_1");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid server_key_id
|
|
||||||
|
|
||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:9:13
|
|
||||||
|
|
|
||||||
9 | let _ = ruma::server_name!("");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid server_name
|
|
||||||
|
|
||||||
error: proc macro panicked
|
|
||||||
--> $DIR/02-invalid-id-macros.rs:10:13
|
|
||||||
|
|
|
||||||
10 | let _ = ruma::user_id!("user:ruma.io");
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: message: Invalid user_id
|
|
Loading…
x
Reference in New Issue
Block a user