diff --git a/web/atward/src/main.rs b/web/atward/src/main.rs index 5fe5b735b..08fa51272 100644 --- a/web/atward/src/main.rs +++ b/web/atward/src/main.rs @@ -30,6 +30,11 @@ fn queries() -> Vec { pattern: Regex::new("^b/(?P\\d+)$").unwrap(), target: |_, captures| Some(format!("https://b.tvl.fyi/{}", &captures["bug"])), }, + // Changelists (e.g. cl/42) + Query { + pattern: Regex::new("^cl/(?P\\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,); + } }