summaryrefslogtreecommitdiff
path: root/Tests
AgeCommit message (Collapse)Author
2021-11-23LibCore+AK: Move MappedFile from AK to LibCoreAndreas Kling
MappedFile is strictly a userspace thing, so it doesn't belong in AK (which is supposed to be user/kernel agnostic.)
2021-11-21LibGfx: Make ImageDecoderPlugin::frame() return ErrorOr<>Andreas Kling
This is a first step towards better error propagation from image codecs.
2021-11-19LibUnicode: Support locales-without-script aliases for ECMA-402Timothy Flynn
As noted by ECMA-402, if a supported locale contains all of a language, script, and region subtag, then the implementation must also support the locale without the script subtag. The most complicated example of this is the zh-TW locale. The list of locales in the CLDR database does not include zh-TW or its maximized zh-Hant-TW variant. Instead, it inlcudes the zh-Hant locale. However, zh-Hant-TW is listed in the default-content locale list in the cldr-core package. This defines an alias from zh-Hant-TW to zh-Hant. We must then also support the zh-Hant-TW alias without the script subtag: zh-TW. This transitively maps zh-TW to zh-Hant, which is a case quite heavily tested by test262.
2021-11-18AK: Implement `acos<T>` correctlyJelle Raaijmakers
This is a naive implementation based on the symmetry with `asin`. Before, I'm not really sure what we were doing, but it was returning wildly incorrect results.
2021-11-18LibRegex: Avoid rewriting `a+` as `a*` as part of atomic rewritingAli Mohammad Pur
The initial `ForkStay` is only needed if the looping block has a following block, if there's no following block or the following block does not attempt to match anything, we should not insert the ForkStay, otherwise we would be rewriting `a+` as `a*` by allowing the 'end' to be executed. Fixes #10952.
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-11-17AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)Andreas Kling
Also add slightly richer parse errors now that we can include a string literal with returned errors. This will allow us to use TRY() when working with JSON data.
2021-11-16LibCrypto: Fix subtracting two negative `SignedBigInteger`sLinus Groh
Currently, we get the following results -1 - -2 = -1 -2 - -1 = 1 Correct would be: -1 - -2 = 1 -2 - -1 = -1 This was already attempted to be fixed in 7ed8970, but that change was incorrect. This directly translates to LibJS BigInts having the same incorrect behavior - it even was tested.
2021-11-13Tests/LibRegex: Add tests for line end anchors in PosixBasicTim Schumacher
2021-11-11Tests/LibGfx: Actually test image decoders in TestImageDecoderAndreas Kling
We were passing raw Gfx::Bitmap objects into the various image decoders instead of encoded image data. This made all of them fail, but the test expectations were set up in a way that aligned with this outcome. With this patch, we now test the codecs for real. Except ICO, since we don't have an ICO file handy. That's a FIXME.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-10AK: Make ByteBuffer::try_* functions return ErrorOr<void>Andreas Kling
Same as Vector, ByteBuffer now also signals allocation failure by returning an ENOMEM Error instead of a bool, allowing us to use the TRY() and MUST() patterns.
2021-11-10AK+Everywhere: Stop including Vector.h from StringView.hAndreas Kling
Preparation for using Error.h from Vector.h. This required moving some things out of line.
2021-11-10LibSQL: Implement table joinsJan de Visser
This patch introduces table joins. It uses a pretty dumb algorithm- starting with a singleton '__unity__' row consisting of a single boolean value, a cartesian product of all tables in the 'FROM' clause is built. This cartesian product is then filtered through the 'WHERE' clause, again without any smarts just using brute force. This patch required a bunch of busy work to allow for example the ColumnNameExpression having to deal with multiple tables potentially having columns with the same name.
2021-11-10LibSQL: Add current statement to the ExecutionContextJan de Visser
Because SQL is the craptastic language that it is, sometimes expressions need to know details about the calling statement. For example the tables in the 'FROM' clause may be needed to determine which columns are referenced in 'WHERE' expressions. So the current statement is added to the ExecutionContext and a new 'execute' overload on Statement is created which takes the Database and the Statement and builds an ExecutionContaxt from those.
2021-11-10LibSQL: Add 'schema' and 'table' to TupleElementDescriptorJan de Visser
These are needed to distinguish columns from different tables with the same column name in one and the same (joined) Tuple. Not quite happy yet with this API; I think some sort of hierarchical structure would be better but we'll burn that bridge when we get there :^)
2021-11-09LibUnicode: Parse the CLDR's defaultContent.json locale listTimothy Flynn
This file contains the list of locales which default to their parent locale's values. In the core CLDR dataset, these locales have their own files, but they are empty (except for identity data). For example: https://github.com/unicode-org/cldr/blob/main/common/main/en_US.xml In the JSON export, these files are excluded, so we currently are not recognizing these locales just by iterating the locale files. This is a prerequisite for upgrading to CLDR version 40. One of these default-content locales is the popular "en-US" locale, which defaults to "en" values. We were previously inferring the existence of this locale from the "en-US-POSIX" locale (many implementations, including ours, strip variants such as POSIX). However, v40 removes the "en-US-POSIX" locale entirely, meaning that without this change, we wouldn't know that "en-US" exists (we would default to "en"). For more detail on this and other v40 changes, see: https://cldr.unicode.org/index/downloads/cldr-40#h.nssoo2lq3cba
2021-11-08LibCore: Use ErrorOr<T> for Core::File::open()Andreas Kling
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_create()Andreas Kling
Another one that was used in a fajillion places.
2021-11-08LibRegex: Don't push LibRegex's "Error" into the global namespaceAndreas Kling
2021-11-02LibJS: Convert the GetValue AO to ThrowCompletionOrIdan Horowitz
2021-11-02LibJS: Convert reference deletion to ThrowCompletionOrIdan Horowitz
2021-10-31Kernel: Write test that crashes ProcFSBen Wiederhake
2021-10-31Tests: Convert test-wasm functions to ThrowCompletionOrIdan Horowitz
2021-10-31AK+Tests: Fix formatting of infinity and NaN valuesDaniel Bertalan
When I added this code in 1472f6d, I forgot to add tests for it. That's why I didn't realize that the values were appended to the wrong FormatBuilder object, so an empty string was returned instead of the expected "nan"/"inf". This made debugging some FPU issues with the ScummVM port significantly more difficult.
2021-10-29LibRegex: Don't ignore empty alternatives in append_alternation()Ali Mohammad Pur
Doing so would cause patterns like `(a|)` to not match the empty string.
2021-10-27Kernel + WindowServer: Re-define the interface to framebuffer devicesLiav A
We create a base class called GenericFramebufferDevice, which defines all the virtual functions that must be implemented by a FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other FramebufferDevice implementations inherit from it. The most important consequence of rearranging the classes is that we now have one IOCTL method, so all drivers should be committed to not override the IOCTL method or make their own IOCTLs of FramebufferDevice. All graphical IOCTLs are known to all FramebufferDevices, and it's up to the specific implementation whether to support them or discard them (so we require extensive usage of KResult and KResultOr, together with virtual characteristic functions). As a result, the interface is much cleaner and understandable to read.
2021-10-25LibSQL Tests: Add tests for `SELECT ... WHERE ...`Jan de Visser
2021-10-24LibC: Fix `%n` conversion specifier in scanf() formatJelle Raaijmakers
Also add a test to prevent this from happening again. There were two bugs: * The number of bytes just after processing the last value was written, instead of the number of bytes after skipping remaining whitespace. Confirmed by testing against GNU's `scanf()` since the man page leaves something to be desired. * The number of bytes was written to the wrong variable argument; i.e. the first argument was overwritten.
2021-10-24Tests: Print full 32-byte range of values in TestScanfJelle Raaijmakers
We are trying to show 8 u32 values, each of which needs at most 8 hexadecimal characters to be shown entirely.
2021-10-24Tests: Reword 'output' to 'return value' in TestScanfJelle Raaijmakers
2021-10-24Tests: Use correct argument count for value conformance in TestScanfJelle Raaijmakers
2021-10-24Tests: Only test truthiness for iswctypeTim Schumacher
2021-10-24Tests: Use proper comparison macros for wctypeTim Schumacher
2021-10-23AK+Everywhere: Make Base64 decoding fallibleBen Wiederhake
2021-10-23AK: Don't crash on invalid Base64 inputBen Wiederhake
In the long-term, we should probably have a way to signal decoding failure. For now, it should suffice to at least not crash. This is particularly relevant because apparently this can be triggered while parsing a PEM certificate, which happens during every TLS connection. Found by OSS Fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38979
2021-10-22LibC: Fix up mblenTim Schumacher
2021-10-22LibC: Fix up mbtowcTim Schumacher
One more proper implementation and one less FIXME.
2021-10-22Tests: Add a unit test to ensure the /dev/mem device works correctlyLiav A
To ensure everything works as expected, a unit test was added with multiple scenarios. This binary has to have the SetUID flag, and we also bind-mount the /usr/Tests directory to allow running of SetUID binaries.
2021-10-21LibC: Implement mbsnrtowcsTim Schumacher
2021-10-21LibC: Implement wcsnrtombsTim Schumacher
2021-10-21LibC: Implement mbrlenTim Schumacher
2021-10-20LibJS: Convert test-js/test-web/test-wasm to ThrowCompletionOrIdan Horowitz
2021-10-20LibJS: Rename define_native_function => define_old_native_functionIdan Horowitz
This method will eventually be removed once all native functions are converted to ThrowCompletionOr
2021-10-20LibJS: Add ThrowCompletionOr versions of the JS native function macrosIdan Horowitz
The old versions were renamed to JS_DECLARE_OLD_NATIVE_FUNCTION and JS_DEFINE_OLD_NATIVE_FUNCTION, and will be eventually removed once all native functions were converted to the new format.
2021-10-17Tests: Remove Clang workaround from TestSourceLocationDaniel Bertalan
Clang 13 now correctly handles `__builtin_FILE()` and `-ffile-prefix-map` being specified together, so this test should fully pass.
2021-10-17LibC: Implement wcslcpyDaniel Bertalan
2021-10-17LibJS: Convert to_double() to ThrowCompletionOrIdan Horowitz
2021-10-17LibJS: Convert to_bigint_int64() to ThrowCompletionOrIdan Horowitz
2021-10-15LibC: Implement mbsrtowcsTim Schumacher