Commit Graph

6 Commits

Author SHA1 Message Date
Andreas Kling
13f4890c38 LibCore: Make Core::File::open() return OSError in case of failure 2021-08-20 15:31:46 +02:00
coderdreams
9ffb3e7e30 LibCore: Add unit test for File::read_line 2021-06-22 18:54:40 +04:30
Jelle Raaijmakers
10e8b99038 LibC: Make getopt modify argv again
A POSIX-compatibility fix was introduced in 64740a0214 to make the
compilation of the `diffutils` port work, which expected a
`char* const* argv` signature.

And indeed, the POSIX spec does not mention permutation of `argv`:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html

However, most implementations do modify `argv` as evidenced by
documentation such as:
https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic
    /LSB-Core-generic/libutil-getopt-3.html

  "The function prototype was aligned with POSIX 1003.1-2008 (ISO/IEC
   9945-2009) despite the fact that it modifies argv, and the library
   maintainers are unwilling to change this."

Change the behavior back to permutate `argc` to allow for the following
command line argument order to work again:

  unzip ./file.zip -o target-dir

Without this change, `./file.zip` in the example above would have been
ignored completely.
2021-06-13 17:05:03 +01:00
Jelle Raaijmakers
d7126fbbc2 LibCore/ArgsParser: Learn how to stop on first non-option
We need this for utilities like `env`, that do not gain anything by
parsing the options passed to the command they are supposed to
execute.
2021-06-08 11:30:58 +02:00
Jelle Raaijmakers
0b0bce78f6 LibCore/ArgsParser: Add test suite
This adds a very basic test suite for ArgsParser that we can use to set
a baseline of functionality that we want to make sure keeps working.
2021-06-08 11:30:58 +02:00
sin-ack
60eb4adac2 Tests: Add InodeWatcher and FileWatcher tests
This patch adds some rudimentary tests for InodeWatcher.  It tests the
basic functionality, but maybe there are corner cases I haven't caught.
Additionally, this is our first LibCore test. :^)
2021-05-12 22:38:20 +02:00