summaryrefslogtreecommitdiff
path: root/Tests
AgeCommit message (Collapse)Author
2023-01-22LibTextCodec: Make utf-16be and utf-16le codecs actually workNico Weber
There were two problems: 1. They didn't handle surrogates 2. They used signed chars, leading to eg 0x00e4 being treated as 0xffe4 Also add a basic test that catches both issues. There's some code duplication with Utf16CodePointIterator::operator*(), but let's get things working first.
2023-01-22AK: Add a String factory to create a string from a single code pointTimothy Flynn
2023-01-21Kernel+LibC: Move LibC/signal_numbers.h to Kernel/API/POSIXAndrew Kaster
Make Userland and Tests users just include signal.h, and move Kernel users to the new API file.
2023-01-21AK: Add `split()` for `String`martinfalisse
2023-01-21AK: Rename double_hash to rehash_for_collisionTimothy Flynn
The name is currently quite confusing as it indicates it hashes doubles.
2023-01-20LibCore: Remove `FileStream`Tim Schumacher
2023-01-20Tests: Use `Core::Stream` to write output files in LibGL testsTim Schumacher
2023-01-20AK: Remove `DuplexMemoryStream`Tim Schumacher
2023-01-20LibCore: Avoid logical OOB read in AllocatingMemoryStream::offset_of()Ali Mohammad Pur
The previous impl was trimming the last chunk to the free space instead of the used space, which yielded an OOB read if the needle wasn't found.
2023-01-20AK: Support creating known short string literals at compile timeTimothy Flynn
In cases where we know a string literal will fit in the short string storage, we can do so at compile time without needing to handle error propagation. If the provided string literal is too long, a compilation error will be emitted due to the failed VERIFY statement being a non- constant expression.
2023-01-20Tests: Use AK::shuffle() for shufflingSam Atkins
2023-01-20Tests/LibGfx: Fix test_gif test caseLiav A
We should expect the GIF image to be animated, therefore fix that condition.
2023-01-20Tests/LibGfx: Fix test_not_ico test caseLiav A
We should expect the sniffing method and the initialize method to fail because this test case is testing that the ICO image decoder should not decode random data within it.
2023-01-20LibGfx: Re-structure the whole initialization pattern for image decodersLiav A
When trying to figure out the correct implementation, we now have a very strong distinction on plugins that are well suited for sniffing, and plugins that need a MIME type to be chosen. Instead of having multiple calls to non-static virtual sniff methods for each Image decoding plugin, we have 2 static methods for each implementation: 1. The sniff method, which in contrast to the old method, gets a ReadonlyBytes parameter and ensures we can figure out the result with zero heap allocations for most implementations. 2. The create method, which just creates a new instance so we don't expose the constructor to everyone anymore. In addition to that, we have a new virtual method called initialize, which has a per-implementation initialization pattern to actually ensure each implementation can construct a decoder object, and then have a correct context being applied to it for the actual decoding.
2023-01-19LibLocale+LibJS: Port locale parsing and processing to StringTimothy Flynn
In order to prevent this commit from having to refactor almost all of Intl, the goal here is to update the internal parsing/canonicalization of locales within LibLocale only. Call sites which are already equiped to handle String and OOM errors do so, however.
2023-01-19Tests: Mark TestCommonmark as DISABLEDSam Atkins
This has no effect right now, but will allow us to use this same cmake file from Lagom.
2023-01-19Tests: Add missing library dependency for LibTimeZone testsSam Atkins
2023-01-19Tests: Add missing library dependencies for LibGL testsSam Atkins
These are required for running on Lagom.
2023-01-19Tests: Move test PDF files into Tests/LibPDFSam Atkins
Let's put test files with the tests themselves, instead of a random user directory. (But still copy them so they appear in the user directory for convenience.)
2023-01-19Tests: Correct `serenity_test()` invocation for LibTTFSam Atkins
Putting the LibTTF tests into the LibGfx directory worked fine before, but causes issues if we try and call this from Lagom. Also, it's tidier to put LibTTF tests in a LibTTF directory. :^)
2023-01-19LibCore: Make the FileWatcher test resilient against outside eventsTimothy Flynn
The test currently watches /tmp, which the OS can create/modify files under at any time outside of our control. So just ignore events that we aren't interested in. Also test removing an item from the FileWatcher.
2023-01-19AK: Don't write trailing zeros with %gPeter Elliott
2023-01-19LibCore: Let offset-related Stream functions return an unsigned valueTim Schumacher
A negative return value doesn't make sense for any of those functions. The return types were inherited from POSIX, where they also need to have an indicator for an error (negative values).
2023-01-18AK+LibUnicode: Provide Unicode-aware caseless String matchingTimothy Flynn
The Unicode spec defines much more complicated caseless matching algorithms in its Collation spec. This implements the "basic" case folding comparison.
2023-01-18LibUnicode: Parse and generate case folding code point dataTimothy Flynn
Case folding rules have a similar mapping style as special casing rules, where one code point may map to zero or more case folding rules. These will be used for case-insensitive string comparisons. To see how case folding can differ from other casing rules, consider "ß" (U+00DF): >>> "ß".lower() 'ß' >>> "ß".upper() 'SS' >>> "ß".title() 'Ss' >>> "ß".casefold() 'ss'
2023-01-18LibCore: Implement FileWatcher for LinuxTimothy Flynn
This implements FileWatcher using inotify filesystem events. Serenity's InodeWatcher is remarkably similar to inotify, so this is almost an identical implementation. The existing TestLibCoreFileWatcher test is added to Lagom (currently just for Linux). This does not implement BlockingFileWatcher as that is currently not used anywhere but on Serenity.
2023-01-17AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()Sam Atkins
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-17AK: Add JsonValue::{is,as}_integer() methodsSam Atkins
The existing `is_i32()` and friends only check if `i32` is their internal type, but a value such as `0` could be literally any integer type internally. `is_integer<T>()` instead determines whether the contained value is an integer and can fit inside T.
2023-01-17LibCore: Do short forward seeks by discarding bytes from the bufferTim Schumacher
This saves us an actual seek and rereading already stored buffer data in cases where the seek is entirely covered by the currently buffered data. This is especially important since we implement `discard` using `seek` for seekable streams.
2023-01-17LibCore: Calculate the correct seek offset for buffered streamsTim Schumacher
2023-01-16AK+LibUnicode: Provide Unicode-aware String titlecase transformationTimothy Flynn
2023-01-16LibUnicode: Support full case folding for titlecasing a stringTimothy Flynn
Unicode declares that to titlecase a string, the first cased code point after each word boundary should be transformed to its titlecase mapping. All other codepoints are transformed to their lowercase mapping.
2023-01-16LibUnicode: Generate simple case folding mappings for titlecaseTimothy Flynn
Note we already generate the special case foldings for titlecase.
2023-01-15AK+Test: Fix a logic error in `CircularBuffer::offset_of()`Lucas CHOLLET
This error was introduced by 9a7accdd and had a significant impact on `BufferedFile` behavior. Hence, we started seeing crash in test262. By itself, the issue was a wrong calculation of the internal reading spans when using the `read` and `until` parameters. Which can lead to at worse crash in VERIFY and at least weird behaviors as missed needles or detections out of bounds. It was also accompanied by an erroneous test. This patch fixes the bug, the test and also provides more tests.
2023-01-15Tests/LibGfx: Add tests for compressed TGA imagesLiav A
2023-01-15Tests/LibGfx: Add tests for top-left and bottom-left TGA imagesLiav A
2023-01-15LibJS+Everywhere: Rename Value::to_string to to_deprecated_stringTimothy Flynn
2023-01-15LibCrypto: Define *BigInteger::to_base to convert big integers to StringTimothy Flynn
2023-01-15LibCrypto+Everywhere: Rename *BigInteger::to_base to to_base_deprecatedTimothy Flynn
2023-01-15AK: Add String::is_one_of for variadic string comparisonTimothy Flynn
2023-01-15AK: Add a somewhat naive implementation of String::reverseTimothy Flynn
This will reverse the String's code points (i.e. not just its bytes), but is not aware of grapheme clusters.
2023-01-14AK: Add an optional starting offset to `CircularBuffer::offset_of`Lucas CHOLLET
This parameter allows to start searching after an offset. For example, to resume a search. It is unfortunately a breaking change in API so this patch also modifies one user and one test.
2023-01-14LibWeb+Tests: Demonstrate slowness of CSS::value_id_from_stringBen Wiederhake
2023-01-14LibWeb: Run tests in lagom if ENABLE_LAGOM_LIBWEB is setBen Wiederhake
2023-01-14AK+Tests: Make CaseInsensitiveStringViewTraits work with HashMap againBen Wiederhake
2023-01-14AK: Remove `CircularDuplexStream`Tim Schumacher
2023-01-14LibCore: Add `AllocatingMemoryStream::offset_of`Tim Schumacher
2023-01-12LibCore+Userland: Make Core::Timer::create_single_shot() return ErrorOrSam Atkins
clang-format sure has some interesting opinions about where to put a method call that comes after a lambda. :thonk:
2023-01-12AK: Implement FlyString for the new String classTimothy Flynn
This implements a FlyString that will de-duplicate String instances. The FlyString will store the raw encoded data of the String instance: If the String is a short string, FlyString holds the String::ShortString bytes; otherwise FlyString holds a pointer to the Detail::StringData. FlyString itself does not know about String's storage or how to refcount its Detail::StringData. It defers to String to implement these details.
2023-01-10LibCompress: Port `DeflateCompressor` to `Core::Stream`Tim Schumacher