Skip to content

Commit

Permalink
Merge pull request #1 from dcodesdev/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dcodesdev authored May 2, 2024
2 parents 61ae199 + eeab29d commit 4ff7a13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/crates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ jobs:
toolchain: stable
override: true

- name: Test cli
- name: Test
run: cargo test
13 changes: 4 additions & 9 deletions crates/cli/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ async fn download_file(url: &str, challenge: &str) -> Result<Downloader, Box<dyn
if file_name == "starter.rs" {
let dl = dl
.set_output_dir(&output_dir)
.file_name("main.rs")
.file_name("lib.rs")
.download(url)
.await;

// After the download, prepend "pub mod tests;\n" to the file
let file_path = format!("{}/main.rs", output_dir);
let file_path = format!("{}/lib.rs", output_dir);
let contents = fs::read_to_string(&file_path).unwrap();
let new_contents = format!("pub mod tests;\n\n{}", contents);
fs::write(&file_path, new_contents).unwrap();
Expand Down Expand Up @@ -115,12 +115,7 @@ mod tests {
for challenge in CHALLENGES {
download(challenge).await;

let paths_to_exist = [
"description.md",
"Cargo.toml",
"src/main.rs",
"src/tests.rs",
];
let paths_to_exist = ["description.md", "Cargo.toml", "src/lib.rs", "src/tests.rs"];

for file in paths_to_exist.iter() {
let path = format!("{}/{}", challenge, file);
Expand Down Expand Up @@ -174,7 +169,7 @@ mod tests {

assert!(result.is_ok());

let path = format!("{}/src/main.rs", challenge);
let path = format!("{}/src/lib.rs", challenge);
assert!(Path::new(&path).exists());

// read the contents of the file
Expand Down

0 comments on commit 4ff7a13

Please sign in to comment.