Skip to content

Commit

Permalink
Add negative test
Browse files Browse the repository at this point in the history
  • Loading branch information
nickray committed Feb 1, 2023
1 parent 0ed3c35 commit 7b66857
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,6 @@ impl<'a, Storage: driver::Storage> Filesystem<'a, Storage> {
mod tests {
use super::*;
use core::convert::TryInto;
use generic_array::typenum::consts;
use driver::Storage as LfsStorage;
use io::Result as LfsResult;
const_ram_storage!(TestStorage, 4096);
Expand Down
18 changes: 15 additions & 3 deletions src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,26 @@ mod tests {
const EMPTY: &Path = path!("");
const SLASH: &Path = path!("/");

#[test]
fn path_macro() {
assert_eq!(EMPTY, &*PathBuf::from(""));
assert_eq!(SLASH, &*PathBuf::from("/"));
}

// does not compile:
// const NON_ASCII: &Path = path!("über");
// const NULL: &Path = path!("ub\0er");

#[test]
fn path_macro() {
assert_eq!(EMPTY, &*PathBuf::from(""));
assert_eq!(SLASH, &*PathBuf::from("/"));
#[should_panic]
fn nul_in_from_str_with_nul() {
Path::from_str_with_nul("ub\0er");
}

#[test]
#[should_panic]
fn non_ascii_in_from_str_with_nul() {
Path::from_str_with_nul("über");
}

#[test]
Expand Down
1 change: 0 additions & 1 deletion tests/test_serde.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use littlefs2::{
consts,
driver,
fs::Filesystem,
io::Result,
Expand Down

0 comments on commit 7b66857

Please sign in to comment.