-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixes, new flags and better logs (#19)
* Add test showing the issue * Fix an issue preventing from using the schema defined in the config * Add debugging to spot issue if the schema cannot be parsed * Deps update * Add ability to override schema
- Loading branch information
Showing
22 changed files
with
290 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ target | |
.env* | ||
!.env-example | ||
executables | ||
.prdoc-sdk.toml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[workspace.package] | ||
version = "0.0.6" | ||
version = "0.0.7" | ||
authors = ["chevdor <[email protected]>", "Wilfried Kopp <[email protected]>"] | ||
edition = "2021" | ||
homepage = "https://github.com/paritytech/prdoc" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,47 @@ | ||
mod common; | ||
|
||
#[cfg(test)] | ||
mod cli_tests { | ||
#[cfg(test)] | ||
mod generate { | ||
use crate::common::prdoc_bin; | ||
use std::fs; | ||
|
||
use assert_cmd::Command; | ||
|
||
#[test] | ||
fn it_generate_fails_without_number() { | ||
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); | ||
let mut cmd = prdoc_bin(); | ||
let assert = cmd.arg("generate").assert(); | ||
assert.failure().code(2); | ||
} | ||
|
||
#[test] | ||
fn it_generate_with_number() { | ||
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); | ||
let mut cmd = prdoc_bin(); | ||
let assert = cmd.args(["generate", "--dry-run", "42"]).assert(); | ||
assert.success().code(exitcode::OK); | ||
} | ||
|
||
#[test] | ||
fn it_does_not_overwrite() { | ||
// Ensure we start without a file so the first generate always work | ||
let _ = fs::remove_file("/tmp/prdoc/pr_9999.prdoc"); | ||
let _ = fs::remove_file("/tmp/pr_9999.prdoc"); | ||
|
||
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); | ||
let assert = cmd.args(["generate", "--output-dir", "/tmp/prdoc", "9999"]).assert(); | ||
let mut cmd = prdoc_bin(); | ||
let assert = cmd.args(["generate", "--output-dir", "/tmp", "9999"]).assert(); | ||
assert.success().code(exitcode::OK); | ||
|
||
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); | ||
let assert = cmd.args(["generate", "--output-dir", "/tmp/prdoc", "9999"]).assert(); | ||
let mut cmd = prdoc_bin(); | ||
let assert = cmd.args(["generate", "--output-dir", "/tmp", "9999"]).assert(); | ||
assert.failure().code(exitcode::IOERR); | ||
} | ||
|
||
#[test] | ||
fn it_should_not_fail() { | ||
let _ = fs::remove_file("/tmp/prdoc/pr_9998.prdoc"); | ||
|
||
let mut cmd = prdoc_bin(); | ||
let assert = cmd.args(["generate", "-d", "/tmp/prdoc/", "9998"]).assert(); | ||
assert.success().code(exitcode::OK); | ||
} | ||
} | ||
} |
Oops, something went wrong.