-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "test" Command #77
base: main
Are you sure you want to change the base?
Conversation
I can code review this |
I can code review this. |
I really like your project! The logic for handling various file flags, string comparisons, and number comparisons works as expected. The overall structure is clean and easy to follow. Also, I really like the test script (test.sh), which covers a wide range of inputs. And I also like how when I input something wrong, it shows me what valid inputs are available. Suggestions for Improvement: 2.The test.sh script is well-constructed. However, more edge cases could be added, such as empty or nonexistent files, handling special characters in file names. High Level Checks: Code Checks: |
Comments: Suggestions: High Level Checks:
Code Checks:
|
Can't say I have any issues with this, especially after adding the tests and fixing even more issues that lie more on the xv6 side of things than yours, really. Just FYI for reviewers, in the shell true / false are flipped compared to what you'd expect in C, so that's why this is the way it is. If I had to nitpick, it needs to be reformatted in xv6 style and some of the indentation is misleading (at least on my editor), but that's not a major problem. Nice work! |
…control, and more examples in README
test
The "test" command evaluates a conditional expression. It is an if statement that will return zero (true), 1 (false), or greater than 1 (error). The "test" command will check if any flags were inputted and, based on the expression, will return a truthy or falsy value.Files Added
user:
Expressions Implemented in Test
Examples
Example 1: File Analysis
test -f cat
Example 2: String Operators
test "hello" = "hell"
Example 3: Number Operators
test 23 -gt 32
Tests
Note: The test script only runs if you add shell scripting support.