Skip to content

Commit

Permalink
Add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Techassi committed Jul 15, 2023
1 parent 07fe746 commit ac3fa41
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions lychee-bin/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,67 @@ mod cli {

Ok(())
}

#[test]
fn test_dump_inputs_glob() -> Result<()> {
let pattern = fixtures_path().join("**/*.md");

let mut cmd = main_command();
cmd.arg("--dump-inputs")
.arg(pattern)
.assert()
.success()
.stdout(contains("fixtures/INTERNET_ARCHIVE.md"))
.stdout(contains("fixtures/TEST.md"))
.stdout(contains("fixtures/TEST_ALL_PRIVATE.md"))
.stdout(contains("fixtures/TEST_CODE_BLOCKS.md"))
.stdout(contains("fixtures/TEST_EMAIL.md"))
.stdout(contains("fixtures/TEST_EMAIL_QUERY_PARAMS.md"))
.stdout(contains("fixtures/TEST_EXAMPLE_DOMAINS.md"))
.stdout(contains("fixtures/TEST_GITHUB.md"))
.stdout(contains("fixtures/TEST_GITHUB_404.md"))
.stdout(contains("fixtures/TEST_SCHEMES.md"))
.stdout(contains("fixtures/exclude-path/dir1/TEST.md"))
.stdout(contains("fixtures/exclude-path/dir2/TEST.md"))
.stdout(contains("fixtures/exclude-path/dir2/subdir/TEST.md"))
.stdout(contains("fixtures/ignore/TEST.md"));

Ok(())
}

#[test]
fn test_dump_inputs_url() -> Result<()> {
let mut cmd = main_command();
cmd.arg("--dump-inputs")
.arg("https://example.com")
.assert()
.success()
.stdout(contains("https://example.com"));

Ok(())
}

#[test]
fn test_dump_inputs_path() -> Result<()> {
let mut cmd = main_command();
cmd.arg("--dump-inputs")
.arg("fixtures")
.assert()
.success()
.stdout(contains("fixtures"));

Ok(())
}

#[test]
fn test_dump_inputs_stdin() -> Result<()> {
let mut cmd = main_command();
cmd.arg("--dump-inputs")
.arg("-")
.assert()
.success()
.stdout(contains("Stdin"));

Ok(())
}
}

0 comments on commit ac3fa41

Please sign in to comment.