Skip to content

Commit

Permalink
additional allowed symbols (#23)
Browse files Browse the repository at this point in the history
* lib

* metadata

* len

* len
  • Loading branch information
sergey-shandar authored Mar 24, 2024
1 parent 8a12c93 commit 793a076
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions io-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ fn not_found() -> io::Error {

fn check_path(a: &str) -> io::Result<()> {
if a.chars()
.all(|c| c.is_ascii_alphanumeric() || c == '/' || c == '_' || c == '.')
.all(|c| c.is_ascii_alphanumeric() || "/_.-".contains(c))
{
Ok(())
} else {
Expand Down Expand Up @@ -326,11 +326,15 @@ mod test {
#[wasm_bindgen_test]
#[test]
fn test() {
fn check_len(m: &super::Metadata, f: fn(m: &super::Metadata) -> u64, len: u64) {
assert_eq!(f(m), len);
}
let io = VirtualIo::new(&[]);
io.write("test.txt", "Hello, world!".as_bytes()).unwrap();
let result = io.read_to_string("test.txt").unwrap();
assert_eq!(result, "Hello, world!");
assert_eq!(io.metadata("test.txt").unwrap().len(), 13);
check_len(&io.metadata("test.txt").unwrap(), Metadata::len, 13);
// assert_eq!(io.metadata("test.txt").unwrap().len(), 13);
assert_eq!(io.current_dir().unwrap(), "");
}

Expand Down

0 comments on commit 793a076

Please sign in to comment.