ladybird/Tests/LibCore
Rodrigo Tobar 5a8373c6b9 LibCore: Fix corner case for files without newlines
When BufferedFile.can_read_line() was invoked on files with no newlines,
t incorrectly returned a false result for this single line that, even
though doesn't finish with a newline character, is still a line. Since
this method is usually used in tandem with read_line(), users would miss
reading this line (and hence all the file contents).

This commit fixes this corner case by adding another check after a
negative result from finding a newline character. This new check does
the same as the check that is done *before* looking for newlines, which
takes care of this problem, but only works for files that have at least
one newline (hence the buffer has already been filled).

A new unit test has been added that shows the use case. Without the
changes in this commit the test fails, which is a testament that this
commit really fixes the underlying issue.
2023-04-09 18:09:23 -06:00
..
10kb.txt LibCore: Fix relative seeking in IODevice 2021-11-30 10:51:10 +01:00
CMakeLists.txt Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
long_lines.txt LibCore: Add unit test for File::read_line 2021-06-22 18:54:40 +04:30
small.txt Tests/LibCore: Add regression test for the read_until_any_of OOB read 2022-01-01 14:44:02 +01:00
TestLibCoreArgsParser.cpp Userland+AK: Stop using getopt() for ArgsParser 2023-02-28 15:52:24 +03:30
TestLibCoreDeferredInvoke.cpp LibCore+Userland: Make Core::Timer::create_single_shot() return ErrorOr 2023-01-12 11:25:51 +01:00
TestLibCoreFilePermissionsMask.cpp LibCore: Implement four-digit modes for FilePermissionsMask parsing 2022-07-27 21:45:01 +00:00
TestLibCoreFileWatcher.cpp LibCore: Make the FileWatcher test resilient against outside events 2023-01-19 11:29:48 +00:00
TestLibCoreIODevice.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
TestLibCoreSharedSingleProducerCircularQueue.cpp LibCore: Remove try_ prefix from fallible SharedCircularQueue methods 2023-01-28 22:41:36 +01:00
TestLibCoreStream.cpp LibCore: Fix corner case for files without newlines 2023-04-09 18:09:23 -06:00