Commit Graph

16 Commits

Author SHA1 Message Date
asynts
c2be38e50f AK: TestSuite: Terminate when ASSERT_NOT_REACHED is called.
Previously, it would just print something with 'FAIL' to stderr which
would be picked up by CTest. However, some code assumes that
ASSERT_NOT_REACHED() doesn't return, for example:

    bool foo(int value) {
        switch(value) {
        case 0:
            return true;
        case 1:
            return false;
        default:
            ASSERT_NOT_REACHED();
        }

        // warning: control reaches end of non-void function
    }
2020-08-22 20:52:19 +02:00
asynts
d2121ab7c7 AK: Make some tweaks in TestSuite.h. 2020-08-22 10:46:56 +02:00
asynts
207b9774e0 AK: Remove <chrono> requirement from TestSuite.h. 2020-08-22 10:46:56 +02:00
asynts
20a7d2c61b AK: Remove exceptions from TestSuite.h.
Serenity is build with -fno-exceptions, this is an effort to make
TestSuite.h useable in the userland.
2020-08-22 10:46:56 +02:00
Ben Wiederhake
54c6886108 AK: TestSuite's main should return 0 2020-08-10 11:51:45 +02:00
Andreas Kling
1ef5d609d9 AK+LibC: Add TODO() as an alternative to ASSERT_NOT_REACHED()
I've been using this in the new HTML parser and it makes it much easier
to understand the state of unfinished code branches.

TODO() is for places where it's okay to end up but we need to implement
something there.

ASSERT_NOT_REACHED() is for places where it's not okay to end up, and
something has gone wrong.
2020-05-30 11:31:49 +02:00
howar6hill
055344f346 AK: Move the wildcard-matching implementation to StringUtils
Provide wrappers in the String and StringView classes, and add some tests.
2020-03-02 10:38:08 +01:00
Andreas Kling
94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andreas Kling
2ad0ec325a AK: Get rid of TStyle (output styling helper for LogStream)
This didn't end up getting used, so let's get rid of it.
2019-11-06 11:37:03 +01:00
Andreas Kling
73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00
Andreas Kling
6560116b67 TestSuite: Hijack the ASSERT macros during unit tests.
Instead of aborting the program when we hit an assertion, just print a
message and keep going.

This allows us to write tests that provoke assertions on purpose.
2019-08-02 09:23:03 +02:00
Andreas Kling
8434548f14 TestSuite: Actually print failed comparions.. :^) 2019-08-01 16:22:50 +02:00
Robin Burchell
a9db382f0e TestSuite: Don't leak the suite instance
Makes checking for leaks more straightforward
2019-07-21 11:51:10 +02:00
Robin Burchell
fc479d1e20 TestSuite: instance() -> the(), and return a reference
To be more consistent with the rest of the codebase
2019-07-21 11:51:10 +02:00
Andreas Kling
2fedf36276 TestSuite: Make tests actually run (oops!)
We were not actually running any of the unit tests, only getting a pointer
to them. Thankfully they all pass, even after we start running them. :^)
2019-07-21 11:27:55 +02:00
Robin Burchell
41d2c674d7 AK: Add a new TestSuite.h from my own work, adapted to match the existing one a bit
This gives a few new features:

* benchmarks
* the ability to run individual testcases easily
* timing of tests
2019-07-16 11:03:38 +02:00