nodejs_path 0.0.8

Port path module (and tests) of nodejs to rust using the same algorithms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate as nodejs_path;

#[test]
fn test_posix() {
    assert_eq!(nodejs_path::posix::dirname("/a/b/"), "/a".to_string());
    assert_eq!(nodejs_path::posix::dirname("/a/b"), "/a".to_string());
    assert_eq!(nodejs_path::posix::dirname("/a"), "/".to_string());
    assert_eq!(nodejs_path::posix::dirname(""), ".".to_string());
    assert_eq!(nodejs_path::posix::dirname("/"), "/".to_string());
    assert_eq!(nodejs_path::posix::dirname("////"), "/".to_string());
    assert_eq!(nodejs_path::posix::dirname("//a"), "//".to_string());
    assert_eq!(nodejs_path::posix::dirname("foo"), ".".to_string());
}