Commit graph

167 commits

Author SHA1 Message Date
Max Wipfli a9a54914bf Tests: Add comments to the HTMLTokenizer regression test file 2021-07-15 00:48:45 +02:00
Max Wipfli 5a44a0b9f4 Tests: Add a basic test suite for HTMLTokenizer
The test suite includes a few basic tests and a very crude regression
test, which just concatenates the to_string() of all tokens and checks
the String's hash to be equal. This relies on the format of
HTMLToken::to_string() to stay the same, which is not ideal.
2021-07-14 23:03:36 +02:00
Daniel Bertalan 6821cd45ed Tests: Fix compile errors on Clang
Since Clang enables a couple of warnings that we don't have in GCC,
these were not caught before. Included fixes:

- Use correct printf format string for `size_t`
- Don't compare Nonnull(Ref|Own)Ptr` to nullptr
- Fix unsigned int& => unsigned long& conversion
2021-07-14 13:12:25 +02:00
Hendiadyoin1 3cc59f6454 Tests: Rename write-oob
The "ue-" prefix makes it clearer that it should be run with the
UserspaceEmulator
2021-07-14 11:26:34 +04:30
Hendiadyoin1 bdde44a833 Tests: Assure that UE does not regress via ue ls 2021-07-14 11:26:34 +04:30
Andrew Kaster 2ca1193d9a Userland+Tests: Convert test_io to be LibTest based
Add a few extra tests as well, to make sure we don't have any future
TmpFs regressions.
2021-07-11 19:42:00 +02:00
Andrew Kaster 4cc75501d7 Utilities+Tests: Convert test_efault to be LibTest based
This test exposed a kernel panic in is_user_range calculations, so let's
convert it to be a LibTest test so we can prevent regressions in mmap,
the page allocator, and the memory manager.
2021-07-11 19:42:00 +02:00
Andreas Kling 88c8451973 AK: Bring back FixedArray<T>
Let's bring this class back, but without the confusing resize() API.
A FixedArray<T> is simply a fixed-size array of T.

The size is provided at run-time, unlike Array<T> where the size is
provided at compile-time.
2021-07-11 17:42:31 +02:00
Ali Mohammad Pur 1c584e9d80 LibRegex: Correctly parse BRE bracket expressions
Commonly, bracket expressions are in fact, enclosed in brackets.
2021-07-10 22:58:24 +04:30
Ali Mohammad Pur daa6d99e6e LibRegex: Add support for non-extended regular expressions in regcomp()
Fixes part of #8506.
2021-07-10 13:33:08 +02:00
Jan de Visser a034774e3a LibSQL+SQLServer: Build SQLServer system service
This patch introduces the SQLServer system server. This service is
supposed to be the only process/application talking to database storage.
This makes things like locking and caching more reliable, easier to
implement, and more efficient.

In LibSQL we added a client component that does the ugly IPC nitty-
gritty for you. All that's needed is setting a number of event handler
lambdas and you can connect to databases and execute statements on them.

Applications that wish to use this SQLClient class obviously need to
link LibSQL and LibIPC.
2021-07-08 17:55:59 +04:30
Jan de Visser 30691549fd LibSQL: Move Order and Nulls enums from SQL::AST to SQL namespace
The Order enum is used in the Meta component of LibSQL. Using this enum
meant having to include the monster AST/AST.h include file. Furthermore,
they are sort of basic and therefore can live in the general SQL
namespace. Moved to LibSQL/Type.h.

Also introduced a new class, SQLResult, which is needed in future
patches.
2021-07-08 17:55:59 +04:30
Gunnar Beutner 75ba74a216 Tests: Build all tests on x86_64
This builds some previously-disabled tests for x86_64.
2021-07-07 15:29:18 +02:00
Timothy Flynn 65003241e4 LibRegex: Allow dollar signs in ECMA262 named capture groups
Fixes 1 test262 test.
2021-07-06 22:33:17 +01:00
Andrew Kaster d0447f23b8 Tests+Base: Convert stack-smash to be LibTest based and stop skipping it
Now that the test is converted to be LibTest based, we can remove it
from the exclude list in /home/anon/.config/Tests.ini.

Prior to this it would crash and fail because it was signaled instead of
returning normally with exit code 0.
2021-07-06 17:22:45 +02:00
Andrew Kaster e4013f6cc6 Tests: Set a default font in BenchmarkGfxPainter to prevent crashes
After the changes to LibGfx to make default font management handled in
WindowServer instead of each GUI application to allow for global font
broadcasts, the two LibGfx tests broke. The non-benchmark was fixed in
8f96d2, but the benchmark was left in the dust because nobody really
runs it manually :^(
2021-07-06 17:22:45 +02:00
Idan Horowitz 53f70e5208 LibJS: Remove the default length & attributes from define_native_*
These are usually incorrect, and people sometimes forget to add the
correct values as a result of them being optional, so they should just
be specified explicitly.
2021-07-06 14:20:30 +01:00
stelar7 ce314c54bd JsonParser: Bring parser more to spec 2021-07-05 12:36:19 +02:00
Linus Groh 1ac3d253c5 LibWeb/WebAssembly+test-wasm: Use get_without_side_effects() more 2021-07-04 22:07:36 +01:00
Tobias Christiansen f35c25a7eb Tests: Add test for String::roman_number_from() 2021-07-04 22:17:03 +02:00
Gunnar Beutner 3bbe86d8ea Everywhere: Prefer using "..."sv over StringView { "..." } 2021-07-04 14:24:03 +02:00
Daniel Bertalan 2ef28602ba Tests: Add tests for Optional's conditionally trivial functions 2021-07-04 07:24:41 +04:30
Daniel Bertalan 39dd13fd17 AK: Destroy original value when assigning to Variant 2021-07-04 07:24:41 +04:30
Daniel Bertalan 9323d459b4 Tests: Add test for supported operation type traits 2021-07-04 07:24:41 +04:30
Max Wipfli 4b87dd5c5c Tests: Add test for String::find with empty needle
This adds a test case for String::find and String::find_all with empty
needles. The expected behavior is in line with what the C++ standard
library (and other languages standard libraries) expect.
2021-07-02 21:54:21 +02:00
Max Wipfli 9cc35d1ba3 AK: Implement String::find_any_of() and StringView::find_any_of()
This implements StringUtils::find_any_of() and uses it in
String::find_any_of() and StringView::find_any_of(). All uses of
find_{first,last}_of have been replaced with find_any_of(), find() or
find_last(). find_{first,last}_of have subsequently been removed.
2021-07-02 21:54:21 +02:00
Max Wipfli 3bdaed501e AK+Everywhere: Remove StringView::find_{first,last}_of(char) methods
This removes StringView::find_first_of(char) and find_last_of(char) and
replaces all its usages with find and find_last respectively. This is
because those two methods are functionally equivalent.
find_{first,last}_of should only be used if searching for multiple
different characters, which is never the case with the char argument.

This also adds the [[nodiscard]] to the remaining find_{first,last}_of
methods.
2021-07-02 21:54:21 +02:00
Spencer Dixon dd3996e207 Tests+LibThreading: Add new tests for LibThreading for detach() 2021-07-02 17:52:45 +02:00
Ali Mohammad Pur b538e15548 LibWasm: Give traps a reason and display it when needed
This makes debugging wasm code a bit easier, as we now know what fails
instead of just "too bad, something went wrong".
2021-07-02 04:53:01 +04:30
Gal Horowitz 172d81a717 LibCrypto: Add tests for SignedBigInteger bitwise operations 2021-07-01 11:37:16 +02:00
Max Wipfli d8be530397 AK+Everywhere: Remove "null state" of LexicalPath
This removes the default constructor of LexicalPath, and subsequently
modifies all its users to accommodate the change.
2021-06-30 11:13:54 +02:00
Max Wipfli 4c018909f7 AK: Make LexicalPath immutable
This replaces the current LexicalPath::append() API with a new method
that returns a new LexicalPath object and doesn't touch the this-object.
With this, LexicalPath is now immutable. It also adds a
LexicalPath::parent() method and the relevant test cases.
2021-06-30 11:13:54 +02:00
Max Wipfli 1e80022282 Tests: Rewrite tests for LexicalPath 2021-06-30 11:13:54 +02:00
Max Wipfli 9b8f35259c AK: Remove the LexicalPath::is_valid() API
Since this is always set to true on the non-default constructor and
subsequently never modified, it is somewhat pointless. Furthermore,
there are arguably no invalid relative paths.
2021-06-30 11:13:54 +02:00
Andrew Kaster 601c9e89de Userland+Tests: Split out generic test runner from JS TestRunner
Split out the functionality to gather multiple tests from the filesystem
and run them in turn into Test::TestRunner, and leave the JavaScript
specific test harness logic in Test::JS::TestRunner and friends.
2021-06-30 08:18:28 +04:30
Andrew Kaster 44a6715584 Tests: TestProcFs cannot assume stdin/stdout/stderr are the same
If someone runs the test with shell redirection going on, or in a way
that changes any of the standard file descriptors this assumption will
not hold. When running from a terminal normally, it is true however.

Instead, check that /proc/self/fd/[0,1,2] are symlinks, and can be
stat-d by verifying that both stat and lstat succeed, and give different
struct stat contents.
2021-06-30 08:18:28 +04:30
Idan Horowitz 005d75656e LibCrypto: Replace from_base{2,8,10,16}() & to_base10 with from_base(N)
This allows us to support parsing and serializing BigIntegers to and
from any base N (such that 2 <= N <= 36).
2021-06-29 16:55:54 +01:00
Ali Mohammad Pur 745a1dbb5d AK: Add and use the RemoveCVReference<T> type trait 2021-06-28 01:08:41 +04:30
Andreas Kling ba9d5c4d54 LibJS: Rename Function => FunctionObject 2021-06-27 22:36:04 +02:00
Ali Mohammad Pur 37b0f55104 AK: Make the constexpr StringView methods actually constexpr
Also add some tests to ensure that they _remain_ constexpr.
In general, any runtime assertions, weirdo C casts, pointer aliasing,
and such shenanigans should be gated behind the (helpfully newly added)
AK::is_constant_evaluated() function when the intention is to write
constexpr-capable code.
a.k.a. deliver promises of constexpr-ness :P
2021-06-27 20:54:59 +01:00
Andreas Kling beb43f673e AK: Undo bogus Variant::downcast() rename
I accidentally renamed these to verify_cast() when doing the global
AK::downcast() rename.
2021-06-26 21:27:58 +02:00
Andreas Kling ee3a73ddbb AK: Rename downcast<T> => verify_cast<T>
This makes it much clearer what this cast actually does: it will
VERIFY that the thing we're casting is a T (using is<T>()).
2021-06-24 19:57:01 +02:00
Daniel Bertalan f820917a76 Everywhere: Use nothrow new with adopt_{ref,own}_if_nonnull
This commit converts naked `new`s to `AK::try_make` and `AK::try_create`
wherever possible. If the called constructor is private, this can not be
done, so we instead now use the standard-defined and compiler-agnostic
`new (nothrow)`.
2021-06-24 17:35:49 +04:30
Gunnar Beutner 6600835802 Tests: Disable kernel and LibC tests for x86_64
Some of the tests assume 32-bit addresses, so let's disable them for now.
2021-06-24 09:27:13 +02:00
Jan de Visser bd5a04fffe LibSQL: Reduce run time of TestSqlDatabase
Scanning tables is a linear process using pointers in the table's
tuples, and does not involve more 'stochastic' code paths like index
traversals. Therefore the 1000 and 10000 row tests were basically
overkill and added nothing we can't find out with less rows.
2021-06-24 09:23:14 +02:00
Max Wipfli b3c3b78b01 Tests: Reduce runtime of TestCharacterTypes
This declares all test cases which compare function outputs over the
entire Unicode range as `BENCHMARK_CASE`, to avoid them being run by CI.
This reduces runtime of TestCharacterTypes (without benchmarks) by about
one third.
2021-06-24 09:16:28 +02:00
Jan de Visser 5c4890411b LibSQL: Make lexer and parser more standard SQL compliant
SQL was standardized before there was consensus on sane language syntax
constructs had evolved. The language is mostly case-insensitive, with
unquoted text converted to upper case. Identifiers can include lower
case characters and other 'special' characters by enclosing the
identifier with double quotes. A double quote is escaped by doubling it.
Likewise, a single quote in a literal string is escaped by doubling it.

All this means that the strategy used in the lexer, where a token's
value is a StringView 'window' on the source string, does not work,
because the value needs to be massaged before being handed to the
parser. Therefore a token now has a String containing its value. Given
the limited lifetime of a token, this is acceptable overhead.

Not doing this means that for example quote removal and double quote
escaping would need to be done in the parser or in AST node
construction, which would spread lexing basically all over the place.
Which would be suboptimal.

There was some impact on the sql utility and SyntaxHighlighter component
which was addressed by storing the token's end position together with
the start position in order to properly highlight it.

Finally, reviewing the tests for parsing numeric literals revealed an
inconsistency in which tokens we accept or reject: `1a` is accepted but
`1e` is rejected. Related to this is the fate of `0x`. Added a FIXME
reminding us to address this.
2021-06-24 00:36:53 +02:00
Jan de Visser 4198f7e1af LibSQL: Move Lexer and Parser machinery to AST directory
The SQL engine is expected to be a fairly sizeable piece of software.
Therefore we're starting to restructure the codebase for growth.
2021-06-24 00:36:53 +02:00
coderdreams 49340f98f7 LibSQL: Create databases in writable directory 2021-06-22 18:54:40 +04:30
coderdreams 9ffb3e7e30 LibCore: Add unit test for File::read_line 2021-06-22 18:54:40 +04:30