Commit Graph

16 Commits

Author SHA1 Message Date
Evan Gates
0cc3beb739 Introduce new test(1) implementation 2014-10-17 15:47:55 +01:00
sin
8311023781 Fix test(1) semantics
Evan Gates says:

After writing my own test[0] I checked and sbase already has test. I'm
including a patch to remove test from the TODO. I also noticed that
sbase's test handles a few specific cases incorrectly (documentation
at [1]).

test ! = foo
When there are 3 arguments and the second is a valid binary primary
test should perform that binary test. Only if the second argument is
not a valid binary primary and the first is ! should test negate the
two argument test. I've attached a patch that should fix this.

test ! ! !
test ! ! ! !
When there are 3 arguments and the second is not a valid primary and
the first is !, test should return the negation of the remaining two
argument test. In this case sbase's test works correctly for ! and ! !
but fails afterwards as it's not recursive. I don't yet have a patch
for this but I'm working on one.

Then again both of these areas may be places in which worse is better.
[0] 11329f3834/test.c
[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
2014-10-16 10:13:05 +01:00
sin
0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
Hiltjo Posthuma
953ebf3573 code style
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:30 +01:00
dwts
459161481a use always static for usage and keep usage definition above main 2014-04-22 14:49:23 +01:00
sin
18fbd4606c Return false in case we invoke `test s1' and s1 is the null string 2013-11-11 12:00:22 +00:00
sin
c23616555b Add support for -k (checking sticky bit) to test(1) 2013-11-11 11:56:32 +00:00
sin
11c078d116 Fix styling issue in test(1) 2013-11-11 11:54:04 +00:00
sin
af1fb0c9c2 Inverse condition to avoid nesting in test(1) 2013-11-11 11:48:54 +00:00
sin
8617b29355 Implement the basic binary operations for test(1) 2013-10-15 15:38:32 +01:00
Connor Lane Smith
7c121e189e test: eprintf in usage 2012-05-15 13:34:32 +01:00
Connor Lane Smith
fcb8821246 revert to per-cmd usage() 2012-05-15 13:32:56 +01:00
Connor Lane Smith
146cca114e new ARGBEGIN & usage() function 2012-05-14 21:28:41 +01:00
Connor Lane Smith
f1259218f2 test: more efficient -e flag 2012-05-14 13:33:07 +01:00
Kurt H Maier
ff96728bdd test: fix compiler warning 2012-04-06 23:37:36 -04:00
Connor Lane Smith
cb291cc394 add test.c (thanks Random832) 2011-11-08 19:35:38 +01:00