Conversation
|
Can you please run |
9fc8fda to
66fe3b6
Compare
Removed two unnecessary lines
I have run |
|
I have added tests. Will add windows support soon. |
|
Implemented windows support. All checks are passing. Maintainers @cakebaker , please review and merge, if there are no issues. |
src/uu/namei/Cargo.toml
Outdated
| [dependencies] | ||
| uucore = { workspace = true } | ||
| clap = { workspace = true } | ||
| selinux = { version = "0.1", optional = true } |
There was a problem hiding this comment.
What's the reason for this old version of the selinux crate? The current version is 0.5.1.
There was a problem hiding this comment.
That is a typo. I have fixed it.
There was a problem hiding this comment.
Can you please also commit the updated Cargo.lock file?
| #[test] | ||
| fn test_fails_on_non_existing_path() { | ||
| let (at, mut ucmd) = at_and_ucmd!(); | ||
| let argmnt = at.plus_as_string("nonexisting"); | ||
|
|
||
| #[cfg(target_os = "windows")] | ||
| let err = "The system cannot find the file specified"; | ||
| #[cfg(not(target_os = "windows"))] | ||
| let err = "No such file or directory"; | ||
|
|
||
| ucmd.arg(argmnt).fails().code_is(1).stderr_contains(err); | ||
| } |
There was a problem hiding this comment.
It's great that you test what happens if a path doesn't exist. What happens in the other case, if a path does exist?
There was a problem hiding this comment.
If path does exist then the code runs as expected. Tests for such cases are given in test_long_arg test_mode_arg etc.
There was a problem hiding this comment.
If path does exist then the code runs as expected
Are you sure? ;-)
I get the following output:
$ cargo run -q namei README.md
f: README.md
/ - No such file or directory (os error 2)
$ echo $?
1
wheras with the original namei I get:
$ namei README.md
f: README.md
- README.md
$ echo $?
0
There was a problem hiding this comment.
I think somewhere i haven't handled absolute vs relative filepaths properly. I will fix it.
Implemented namei command without selinux support. Will add that soon...