mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
test every OofError variant done
This commit is contained in:
parent
67bd239acb
commit
1059ba03ec
@ -215,6 +215,8 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use std::os::unix::prelude::OsStringExt;
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
fn gen_args(text: &str) -> Vec<OsString> {
|
fn gen_args(text: &str) -> Vec<OsString> {
|
||||||
@ -283,8 +285,14 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_invalid_unicode_flag() {
|
fn test_invalid_unicode_flag() {
|
||||||
// let invalid_unicode_flag = char::from();
|
// `invalid_unicode_flag` has to contain a leading hyphen to be considered a flag.
|
||||||
// TODO: how to store invalid unicode?
|
let invalid_unicode_flag = OsString::from_vec(vec![45, 0, 0, 0, 255, 255, 255, 255]);
|
||||||
|
let result = filter_flags(vec![invalid_unicode_flag.clone()], &[]).unwrap_err();
|
||||||
|
|
||||||
|
assert!(match result {
|
||||||
|
OofError::InvalidUnicode(flag) if flag == invalid_unicode_flag => true,
|
||||||
|
_ => false,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// asdasdsa
|
// asdasdsa
|
||||||
|
Loading…
x
Reference in New Issue
Block a user