diff options
author | Vincent Ambo <mail@tazj.in> | 2021-05-03T23·09+0200 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2021-05-04T15·47+0000 |
commit | 57502cfc4674a66e1967c673668bc7dea0af2ff6 (patch) | |
tree | 34828c985f5f425cc4fff736ef60eeaae8bf898a /web/atward/src/main.rs | |
parent | 47986fdc216ac03b8005416e4d646421ddd9e6ef (diff) |
feat(atward): Add query for changelists r/2564
Adds a query for things like cl/42 Change-Id: I144ee25c0f2c9956c81b349d653c5fec42602f9f Reviewed-on: https://cl.tvl.fyi/c/depot/+/3092 Tested-by: BuildkiteCI Reviewed-by: eta <eta@theta.eu.org>
Diffstat (limited to 'web/atward/src/main.rs')
-rw-r--r-- | web/atward/src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/web/atward/src/main.rs b/web/atward/src/main.rs index 5fe5b735ba47..08fa51272819 100644 --- a/web/atward/src/main.rs +++ b/web/atward/src/main.rs @@ -30,6 +30,11 @@ fn queries() -> Vec<Query> { pattern: Regex::new("^b/(?P<bug>\\d+)$").unwrap(), target: |_, captures| Some(format!("https://b.tvl.fyi/{}", &captures["bug"])), }, + // Changelists (e.g. cl/42) + Query { + pattern: Regex::new("^cl/(?P<cl>\\d+)$").unwrap(), + target: |_, captures| Some(format!("https://cl.tvl.fyi/{}", &captures["cl"])), + }, ] } @@ -80,4 +85,15 @@ mod tests { assert_eq!(dispatch(&queries(), "something only mentioning b/42"), None,); assert_eq!(dispatch(&queries(), "b/invalid"), None,); } + + #[test] + fn cl_query() { + assert_eq!( + dispatch(&queries(), "cl/42"), + Some("https://cl.tvl.fyi/42".to_string()) + ); + + assert_eq!(dispatch(&queries(), "something only mentioning cl/42"), None,); + assert_eq!(dispatch(&queries(), "cl/invalid"), None,); + } } |