Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an integration test to check if the analyzer comments are present at website-copy #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,327 changes: 1,243 additions & 84 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-analyzer"
version = "0.4.1"
version = "0.4.2"
edition = "2018"
description = "Exercism's automated analyzer for the Rust track."

@@ -22,3 +22,8 @@ features = ["full"]

[dev-dependencies]
rayon = "1.0.3"

[dev-dependencies.reqwest]
version = "0.9.18"
default-features = false
features = ["rustls-tls"]
40 changes: 40 additions & 0 deletions tests/comments.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use rust_analyzer::analyzers;
use std::fmt::Display;

const WEBSITE_COPY_URL_PREFIX: &str =
"https://api.github.com/repos/exercism/website-copy/contents/automated-comments";

fn check_if_comments_exist(comments: &[impl Display]) {
comments
.iter()
.map(|comment| {
format!(
"{}/{}.md",
WEBSITE_COPY_URL_PREFIX,
comment.to_string().replace(".", "/")
)
})
.for_each(|url| {
assert!(
reqwest::get(&url).unwrap().status().is_success(),
"failed to locate the comment at the website-copy repository; url = {}",
url
)
});
}

#[test]
fn general_analyzer_comments_are_present_at_website_copy() {
use analyzers::comments::GeneralComment::*;
check_if_comments_exist(&[SolutionFileNotFound, FailedToParseSolutionFile]);
}

#[test]
fn reverse_string_analyzer_comments_are_present_at_website_copy() {
use analyzers::reverse_string::comments::ReverseStringComment::*;
check_if_comments_exist(&[
SuggestRemovingExternCrate,
SuggestDoingBonusTest,
SolutionFunctionNotFound,
]);
}