forked from emk/subtitles-rs
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test CLI subcommands that don't require video
We don't have any sample video files yet, so we can't test the more complicated cases. This allows us to get rid of `cargo build` in our CI configuration, because cargo will automatically build the CLI so that we can test it.
- Loading branch information
Showing
5 changed files
with
60 additions
and
2 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 |
---|---|---|
|
@@ -16,5 +16,4 @@ matrix: | |
osx_image: xcode8 | ||
rust: stable | ||
script: | ||
- cargo build --verbose | ||
- cargo test --verbose |
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
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 |
---|---|---|
|
@@ -16,5 +16,4 @@ install: | |
build: false | ||
|
||
test_script: | ||
- cargo build --verbose | ||
- cargo test --verbose |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
extern crate cli_test_dir; | ||
|
||
use cli_test_dir::TestDir; | ||
use std::str::from_utf8; | ||
|
||
#[test] | ||
fn show_help() { | ||
let testdir = TestDir::new("substudy", "show_help"); | ||
let output = testdir.cmd() | ||
.arg("--help") | ||
.output() | ||
.expect("could not run substudy"); | ||
assert!(output.status.success()); | ||
assert!(from_utf8(&output.stdout).unwrap().find("substudy --help").is_some()); | ||
} | ||
|
||
#[test] | ||
fn show_version() { | ||
let testdir = TestDir::new("substudy", "show_version"); | ||
let output = testdir.cmd() | ||
.arg("--version") | ||
.output() | ||
.expect("could not run substudy"); | ||
assert!(output.status.success()); | ||
assert!(from_utf8(&output.stdout).unwrap().find("substudy ").is_some()); | ||
} | ||
|
||
#[test] | ||
fn cmd_clean() { | ||
let testdir = TestDir::new("substudy", "cmd_clean"); | ||
let output = testdir.cmd() | ||
.arg("clean") | ||
.arg(testdir.src_path("fixtures/sample.en.srt")) | ||
.output() | ||
.expect("could not run substudy"); | ||
assert!(output.status.success()); | ||
assert!(from_utf8(&output.stdout).unwrap().find("Yay!").is_some()); | ||
} | ||
|
||
#[test] | ||
fn cmd_combine() { | ||
let testdir = TestDir::new("substudy", "cmd_combine"); | ||
let output = testdir.cmd() | ||
.arg("combine") | ||
.arg(testdir.src_path("fixtures/sample.es.srt")) | ||
.arg(testdir.src_path("fixtures/sample.en.srt")) | ||
.output() | ||
.expect("could not run substudy"); | ||
assert!(output.status.success()); | ||
assert!(from_utf8(&output.stdout).unwrap().find("Yay!").is_some()); | ||
assert!(from_utf8(&output.stdout).unwrap().find("¡Si!").is_some()); | ||
} |