Skip to content

Commit f402827

Browse files
committed
refactor: wrap tests in mod tests in subreddit.rs
1 parent 5e95d82 commit f402827

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

src/subreddit.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -646,16 +646,21 @@ pub async fn rss(req: Request<Body>) -> Result<Response<Body>, String> {
646646
Ok(res)
647647
}
648648

649-
#[tokio::test(flavor = "multi_thread")]
650-
async fn test_fetching_subreddit() {
651-
let subreddit = subreddit("rust", false).await;
652-
assert!(subreddit.is_ok());
653-
}
649+
#[cfg(test)]
650+
mod tests {
651+
use super::*;
652+
653+
#[tokio::test(flavor = "multi_thread")]
654+
async fn test_fetching_subreddit() {
655+
let subreddit = subreddit("rust", false).await;
656+
assert!(subreddit.is_ok());
657+
}
654658

655-
#[tokio::test(flavor = "multi_thread")]
656-
async fn test_gated_and_quarantined() {
657-
let quarantined = subreddit("edgy", true).await;
658-
assert!(quarantined.is_ok());
659-
let gated = subreddit("drugs", true).await;
660-
assert!(gated.is_ok());
659+
#[tokio::test(flavor = "multi_thread")]
660+
async fn test_gated_and_quarantined() {
661+
let quarantined = subreddit("edgy", true).await;
662+
assert!(quarantined.is_ok());
663+
let gated = subreddit("drugs", true).await;
664+
assert!(gated.is_ok());
665+
}
661666
}

0 commit comments

Comments
 (0)