Commit Graph

32 Commits

Author SHA1 Message Date
sin
4093341657 test: Remove unused variable 2016-03-26 08:18:47 +00:00
Mattias Andrée
35a114acd5 test: add support for big integers
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-03-26 08:18:47 +00:00
Mattias Andrée
1ea414e300 test: add -k, -ef, -ot, and -nt
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-03-26 08:18:47 +00:00
FRIGN
99ded174b2 Audit test(1)
Only add empty lines before returns, everything else is ok.
Also add the STANDARDS-section to the manpage, which was only
present as a heading until now.
2015-03-17 23:35:11 +01:00
Evan Gates
cf5114a133 untypedef expr, find, test, as is existing style in sbase 2015-03-17 20:04:26 +00:00
sin
f919f2f2a4 test: Fix -e, -r, -w and -x
We return 0 when the expression evaluates to true.  access() returns
0 on a successful call so check against that.
2015-03-13 23:44:18 +00:00
FRIGN
3fa85f0f5e Fix argument parsing in test(1) and chmod(1)
We just take the raw argument list as is. Using arg.h, arguments
beginning with - would have been "eaten up".
Writing a special "bailout" for arg.h was not a good option,
not because it's not impossible (done in 6 LOC), but because it
is a shoehorning around a corner case present for a few programs
which are broken by design by POSIX.
2015-03-13 23:50:09 +01:00
Evan Gates
796b85a297 test: Minor cleanup
1) use arg.h
2) !strcmp
3) **argv to *argv[]
4) fix test to check if basename(argv0) == "[" but avoid
basename(3p) as it may change the contents of the string
passed to it and I didn't want to make a copy.
2015-03-05 08:04:52 +00:00
Evan Gates
fb89ed012b re-typedef Test, use NOTREACHED comment instead of comma operator, both as per style guide 2015-02-25 21:08:35 +00:00
noname
274f9eaf42 Replace strlen with unary_n to test zero length. 2015-02-22 19:40:28 +00:00
Evan Gates
3751dd546f no need for libutf in test, a null byte is a null byte 2015-02-20 19:29:28 +00:00
FRIGN
31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
FRIGN
360a63769c Use strtonum and libutf in test(1), refactor code and manpage
and mark it as finished in README.
2015-02-09 22:21:23 +01:00
FRIGN
ec8246bbc6 Un-boolify sbase
It actually makes the binaries smaller, the code easier to read
(gems like "val == true", "val == false" are gone) and actually
predictable in the sense of that we actually know what we're
working with (one bitwise operator was quite adventurous and
should now be fixed).

This is also more consistent with the other suckless projects
around which don't use boolean types.
2014-11-14 10:54:20 +00:00
FRIGN
7d2683ddf2 Sort includes and more cleanup and fixes in util/ 2014-11-14 10:54:10 +00:00
FRIGN
eee98ed3a4 Fix coding style
It was about damn time. Consistency is very important in such a
big codebase.
2014-11-13 18:08:43 +00:00
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