summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibTest
AgeCommit message (Collapse)Author
2023-04-30LibTest: Add a EXPECT_APPROXIMATE_WITH_ERROR macro with custom errorNico Weber
2023-04-09LibTest: Add a `TRY_OR_FAIL` macroTim Schumacher
This macro has the usual `TRY` semantics, but instead of returning the error, it will let the test fail with the formatted error as the fail message.
2023-04-03LibTest: Don't output information on tests if none existLucas CHOLLET
2023-03-24Libraries: Convert `DeprecatedFile` usages to `LibFileSystem`Cameron Youell
2023-03-21Everywhere: Use `LibFileSystem` where trivialCameron Youell
2023-03-17LibJS: Propagate errors from VM creationTimothy Flynn
2023-03-13Everywhere: Remove unintentional partial stream reads and writesTim Schumacher
2023-03-13AK: Rename Stream::{read,write} to Stream::{read_some,write_some}Tim Schumacher
Similar to POSIX read, the basic read and write functions of AK::Stream do not have a lower limit of how much data they read or write (apart from "none at all"). Rename the functions to "read some [data]" and "write some [data]" (with "data" being omitted, since everything here is reading and writing data) to make them sufficiently distinct from the functions that ensure to use the entire buffer (which should be the go-to function for most usages). No functional changes, just a lot of new FIXMEs.
2023-03-09LibTest: Add option to run each benchmark several timesDan Klishch
This allows to print statistical information (minimum, average, maximum execution time) about benchmark execution.
2023-03-06Everywhere: Remove NonnullRefPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullRefPtrVectorAndreas Kling
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-01LibCore+Everywhere: Remove ArgsParser::add*(char const*&)Ali Mohammad Pur
This is not guaranteed to always work correctly as ArgsParser deals in StringViews and might have a non-properly-null-terminated string as a value. As a bonus, using StringView (and DeprecatedString where necessary) leads to nicer looking code too :^)
2023-02-28Userland+AK: Stop using getopt() for ArgsParserAli Mohammad Pur
This commit moves the implementation of getopt into AK, and converts its API to understand and use StringView instead of char*. Everything else is caught in the crossfire of making Option::accept_value() take a StringView instead of a char const*. With this, we must now pass a Span<StringView> to ArgsParser::parse(), applications using LibMain are unaffected, but anything not using that or taking its own argc/argv has to construct a Vector<StringView> for this method.
2023-02-21LibTest: Fix minor const-correctness issue in TestSuite::find_cases()Andreas Kling
2023-02-17LibJS+Everywhere: Convert JS::Error to StringTimothy Flynn
This includes an Error::create overload to create an Error from a UTF-8 StringView. If creating a String from that view fails, the factory will return an OOM InternalError instead. VM::throw_completion can also make use of this overload via its perfect forwarding.
2023-02-16LibJS: Convert remaining usages of Value::TDSWOSE to Value::TSWOSETimothy Flynn
Note the couple of cases using MUST are just debugging statements.
2023-02-16LibJS+Everywhere: Deprecate Value::to_string_without_side_effectsTimothy Flynn
2023-02-13LibCore: Remove `Stream.h`Tim Schumacher
2023-02-13LibCore: Move Stream-based file into the `Core` namespaceTim Schumacher
2023-02-13LibCore: Rename `File` to `DeprecatedFile`Tim Schumacher
As usual, this removes many unused includes and moves used includes further down the chain.
2023-01-29LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errorsTimothy Flynn
Note that as of this commit, there aren't any such throwers, and the call site in Heap::allocate will drop exceptions on the floor. This commit only serves to change the declaration of the overrides, make sure they return an empty value, and to propagate OOM errors frm their base initialize invocations.
2023-01-26LibTest: Replace uses of JsonObject::get_deprecated()/get_ptr()Sam Atkins
2023-01-17AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()Sam Atkins
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-02Everywhere: Remove unused includes of AK/Format.hBen Wiederhake
These instances were detected by searching for files that include AK/Format.h, but don't match the regex: \\b(CheckedFormatString|critical_dmesgln|dbgln|dbgln_if|dmesgln|FormatBu ilder|__FormatIfSupported|FormatIfSupported|FormatParser|FormatString|Fo rmattable|Formatter|__format_value|HasFormatter|max_format_arguments|out |outln|set_debug_enabled|StandardFormatter|TypeErasedFormatParams|TypeEr asedParameter|VariadicFormatParams|v_critical_dmesgln|vdbgln|vdmesgln|vf ormat|vout|warn|warnln|warnln_if)\\b (Without the linebreaks.) This regex is pessimistic, so there might be more files that don't actually use any formatting functions. Observe that this revealed that Userland/Libraries/LibC/signal.cpp is missing an include. In theory, one might use LibCPP to detect things like this automatically, but let's do this one step after another.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-12-03Everywhere: Run clang-formatLinus Groh
2022-11-26Everywhere: Add support for compilation under emscriptenAli Mohammad Pur
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-11-23LibJS: Make Parser::Error a standalone ParserError classAndreas Kling
This allows us to forward declare it and reduce the number of things that need to include Parser.h.
2022-11-17LibTest: Fail if the top-level result of running a JS file is an errordavidot
Before putting `throw 1;` in a test file did not fail the file, and it ignored the rest of the file. Now we check the resulting completion from run and fail if that is an error.
2022-11-01Everywhere: Explicitly link all binaries against the LibC targetTim Schumacher
Even though the toolchain implicitly links against -lc, it does not know where it should get LibC from except for the sysroot. In the case of Clang this causes it to pick up the LibC stub instead, which might be slightly outdated and feature missing symbols. This is currently not an issue that manifests because we pass through the dependency on LibC and other libraries by accident, which causes CMake to link against the LibC target (instead of just the library), and thus points the linker at the build output directory. Since we are looking to fix that in the upcoming commits, let's make sure that everything will still be able to find the proper LibC first.
2022-10-24AK+Everywhere: Turn bool keep_empty to an enum in split* functionsdemostanis
2022-10-10Everywhere: Replace uses of __serenity__ with AK_OS_SERENITYAndrew Kaster
Now that we have OS macros for essentially every supported OS, let's try to use them everywhere.
2022-09-11LibTest: Extract some useful functions from TestRunner.hdavidot
This allows other test like programs to use these without needing to link to LibTest.
2022-09-06LibJS: Make Script and Module GC-allocatedAndreas Kling
This ensures that code currently in any active or saved execution stack always stays alive.
2022-08-28LibJS: Turn initialize_global_object() into a regular initialize()Linus Groh
There's nothing special about global object initialization anymore, this can just work the same way as for any other object now.
2022-08-23LibJS: Remove {Bytecode::,}Interpreter::global_object()Linus Groh
The basic idea is that a global object cannot just come out of nowhere, it must be associated to a realm - so get it from there, if needed. This is to enforce the changes from all the previous commits by not handing out global objects unless you actually have an initialized realm (either stored somewhere, or the VM's current realm).
2022-08-23LibJS+LibWeb: Reduce use of GlobalObject as an intermediaryLinus Groh
- Prefer VM::current_realm() over GlobalObject::associated_realm() - Prefer VM::heap() over GlobalObject::heap() - Prefer Cell::vm() over Cell::global_object() - Prefer Wrapper::vm() over Wrapper::global_object() - Inline Realm::global_object() calls used to access intrinsics as they will later perform a direct lookup without going through the global object
2022-08-23LibJS: Pass Realm to define_native_{accessor,function}()Linus Groh
This is needed so that the allocated NativeFunction receives the correct realm, usually forwarded from the Object's initialize() function, rather than using the current realm.
2022-08-23LibJS: Pass Realm to GlobalObject::initialize_global_object()Linus Groh
Global object initialization is tightly coupled to realm creation, so simply pass it to the function instead of relying on the non-standard 'associated realm' concept, which I'd like to remove later. This works essentially the same way as regular Object::initialize() now. Additionally this allows us to forward the realm to GlobalObject's add_constructor() / initialize_constructor() helpers, so they set the correct realm on the allocated constructor function object.
2022-08-23LibJS: Remove GlobalObject parameter from native functionsLinus Groh
2022-08-23LibJS: Replace GlobalObject with VM in JSON AOs [Part 13/19]Linus Groh
2022-08-23LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]Linus Groh
This is where the fun begins. :^)
2022-08-05LibJS: Let Shape store a Realm instead of a GlobalObjectAndreas Kling
This is a cautious first step towards being able to create JS objects before a global object has been instantiated.
2022-07-14LibCore: Replace the ArgsParser option argument setting with an enumTim Schumacher
Replacement conditions for `requires_argument` have been chosen based on what would be most convenient for implementing an eventual optional argument mode.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-20Everywhere: Move js/web/wasm tests under /home/anon/TestsBrian Gianforcaro
2022-03-18LibJS: Add infallible variant of VM::push_execution_context()Linus Groh
It makes no sense to require passing a global object and doing a stack space check in some cases where running out of stack is highly unlikely, we can't recover from errors, and currently ignore the result anyway. This is most commonly in constructors and when setting things up, rather than regular function calls.
2022-03-16LibTest: Provide detailed per-file JSON output with --per-fileAli Mohammad Pur
This makes test-js style runners dump out output in the same format as libjs-test262's per-file output.