use assert_cmd::Command;
use std::fs;
#[test]
fn test_file_redirect() {
let mut cmd = Command::cargo_bin("token-count").unwrap();
let input = fs::read_to_string("tests/fixtures/ascii.txt").unwrap();
cmd.write_stdin(input);
cmd.assert().success();
}
#[test]
fn test_unicode_file() {
let mut cmd = Command::cargo_bin("token-count").unwrap();
let input = fs::read_to_string("tests/fixtures/unicode.txt").unwrap();
cmd.write_stdin(input);
cmd.assert().success();
}
#[test]
fn test_invalid_utf8() {
let mut cmd = Command::cargo_bin("token-count").unwrap();
let input = fs::read("tests/fixtures/invalid_utf8.bin").unwrap();
cmd.write_stdin(input);
cmd.assert().failure();
}