mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:47:44 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -78,7 +78,7 @@ bool Crash::do_report(Report report)
|
|||
out("\x1B[31mFAIL\x1B[0m: ");
|
||||
|
||||
report.visit(
|
||||
[&](const Failure& failure) {
|
||||
[&](Failure const& failure) {
|
||||
switch (failure) {
|
||||
case Failure::DidNotCrash:
|
||||
out("Did not crash");
|
||||
|
@ -90,7 +90,7 @@ bool Crash::do_report(Report report)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
},
|
||||
[&](const int& signal) {
|
||||
[&](int const& signal) {
|
||||
out("Terminated with signal {}", signal);
|
||||
});
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
{ \
|
||||
::Test::JS::g_run_file = hook; \
|
||||
} \
|
||||
static ::Test::JS::IntermediateRunFileResult hook(const String&, JS::Interpreter&, JS::ExecutionContext&); \
|
||||
static ::Test::JS::IntermediateRunFileResult hook(String const&, JS::Interpreter&, JS::ExecutionContext&); \
|
||||
} __testjs_common_run_file {}; \
|
||||
::Test::JS::IntermediateRunFileResult __TestJS_run_file::hook(__VA_ARGS__)
|
||||
|
||||
|
@ -164,7 +164,7 @@ enum class RunFileHookResult {
|
|||
};
|
||||
|
||||
using IntermediateRunFileResult = AK::Result<JSFileResult, RunFileHookResult>;
|
||||
extern IntermediateRunFileResult (*g_run_file)(const String&, JS::Interpreter&, JS::ExecutionContext&);
|
||||
extern IntermediateRunFileResult (*g_run_file)(String const&, JS::Interpreter&, JS::ExecutionContext&);
|
||||
|
||||
class TestRunner : public ::Test::TestRunner {
|
||||
public:
|
||||
|
@ -178,10 +178,10 @@ public:
|
|||
virtual ~TestRunner() = default;
|
||||
|
||||
protected:
|
||||
virtual void do_run_single_test(const String& test_path, size_t, size_t) override;
|
||||
virtual void do_run_single_test(String const& test_path, size_t, size_t) override;
|
||||
virtual Vector<String> get_test_paths() const override;
|
||||
virtual JSFileResult run_file_test(const String& test_path);
|
||||
void print_file_result(const JSFileResult& file_result) const;
|
||||
virtual JSFileResult run_file_test(String const& test_path);
|
||||
void print_file_result(JSFileResult const& file_result) const;
|
||||
|
||||
String m_common_path;
|
||||
};
|
||||
|
@ -261,7 +261,7 @@ inline ErrorOr<JsonValue> get_test_results(JS::Interpreter& interpreter)
|
|||
return JsonValue::from_string(json_string);
|
||||
}
|
||||
|
||||
inline void TestRunner::do_run_single_test(const String& test_path, size_t, size_t)
|
||||
inline void TestRunner::do_run_single_test(String const& test_path, size_t, size_t)
|
||||
{
|
||||
auto file_result = run_file_test(test_path);
|
||||
if (!m_print_json)
|
||||
|
@ -274,7 +274,7 @@ inline void TestRunner::do_run_single_test(const String& test_path, size_t, size
|
|||
inline Vector<String> TestRunner::get_test_paths() const
|
||||
{
|
||||
Vector<String> paths;
|
||||
iterate_directory_recursively(m_test_root, [&](const String& file_path) {
|
||||
iterate_directory_recursively(m_test_root, [&](String const& file_path) {
|
||||
if (!file_path.ends_with(".js"))
|
||||
return;
|
||||
if (!file_path.ends_with("test-common.js"))
|
||||
|
@ -284,7 +284,7 @@ inline Vector<String> TestRunner::get_test_paths() const
|
|||
return paths;
|
||||
}
|
||||
|
||||
inline JSFileResult TestRunner::run_file_test(const String& test_path)
|
||||
inline JSFileResult TestRunner::run_file_test(String const& test_path)
|
||||
{
|
||||
g_currently_running_test = test_path;
|
||||
|
||||
|
@ -404,7 +404,7 @@ inline JSFileResult TestRunner::run_file_test(const String& test_path)
|
|||
file_result.logged_messages.append(message.to_string_without_side_effects());
|
||||
}
|
||||
|
||||
test_json.value().as_object().for_each_member([&](const String& suite_name, const JsonValue& suite_value) {
|
||||
test_json.value().as_object().for_each_member([&](String const& suite_name, JsonValue const& suite_value) {
|
||||
Test::Suite suite { test_path, suite_name };
|
||||
|
||||
VERIFY(suite_value.is_object());
|
||||
|
@ -461,7 +461,7 @@ inline JSFileResult TestRunner::run_file_test(const String& test_path)
|
|||
return file_result;
|
||||
}
|
||||
|
||||
inline void TestRunner::print_file_result(const JSFileResult& file_result) const
|
||||
inline void TestRunner::print_file_result(JSFileResult const& file_result) const
|
||||
{
|
||||
if (file_result.most_severe_test_result == Test::Result::Fail || file_result.error.has_value()) {
|
||||
print_modifiers({ BG_RED, FG_BLACK, FG_BOLD });
|
||||
|
|
|
@ -25,7 +25,7 @@ HashMap<String, FunctionWithLength> s_exposed_global_functions;
|
|||
Function<void()> g_main_hook;
|
||||
Function<NonnullOwnPtr<JS::Interpreter>()> g_create_interpreter_hook;
|
||||
HashMap<bool*, Tuple<String, String, char>> g_extra_args;
|
||||
IntermediateRunFileResult (*g_run_file)(const String&, JS::Interpreter&, JS::ExecutionContext&) = nullptr;
|
||||
IntermediateRunFileResult (*g_run_file)(String const&, JS::Interpreter&, JS::ExecutionContext&) = nullptr;
|
||||
String g_test_root;
|
||||
int g_test_argc;
|
||||
char** g_test_argv;
|
||||
|
@ -88,7 +88,7 @@ int main(int argc, char** argv)
|
|||
#endif
|
||||
bool print_json = false;
|
||||
bool per_file = false;
|
||||
const char* specified_test_root = nullptr;
|
||||
char const* specified_test_root = nullptr;
|
||||
String common_path;
|
||||
String test_glob;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace AK {
|
||||
template<typename... Parameters>
|
||||
void warnln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&...);
|
||||
void warnln(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&...);
|
||||
}
|
||||
|
||||
namespace Test {
|
||||
|
|
|
@ -20,7 +20,7 @@ using TestFunction = Function<void()>;
|
|||
|
||||
class TestCase : public RefCounted<TestCase> {
|
||||
public:
|
||||
TestCase(const String& name, TestFunction&& fn, bool is_benchmark)
|
||||
TestCase(String const& name, TestFunction&& fn, bool is_benchmark)
|
||||
: m_name(name)
|
||||
, m_function(move(fn))
|
||||
, m_is_benchmark(is_benchmark)
|
||||
|
@ -28,8 +28,8 @@ public:
|
|||
}
|
||||
|
||||
bool is_benchmark() const { return m_is_benchmark; }
|
||||
const String& name() const { return m_name; }
|
||||
const TestFunction& func() const { return m_function; }
|
||||
String const& name() const { return m_name; }
|
||||
TestFunction const& func() const { return m_function; }
|
||||
|
||||
private:
|
||||
String m_name;
|
||||
|
@ -38,7 +38,7 @@ private:
|
|||
};
|
||||
|
||||
// Helper to hide implementation of TestSuite from users
|
||||
void add_test_case_to_suite(const NonnullRefPtr<TestCase>& test_case);
|
||||
void add_test_case_to_suite(NonnullRefPtr<TestCase> const& test_case);
|
||||
void set_suite_setup_function(Function<void()> setup);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
virtual void run(String test_glob);
|
||||
|
||||
const Test::Counts& counts() const { return m_counts; }
|
||||
Test::Counts const& counts() const { return m_counts; }
|
||||
|
||||
bool is_printing_progress() const { return m_print_progress; }
|
||||
|
||||
|
@ -65,8 +65,8 @@ protected:
|
|||
void print_test_results_as_json() const;
|
||||
|
||||
virtual Vector<String> get_test_paths() const = 0;
|
||||
virtual void do_run_single_test(const String&, size_t current_test_index, size_t num_tests) = 0;
|
||||
virtual const Vector<String>* get_failed_test_names() const { return nullptr; }
|
||||
virtual void do_run_single_test(String const&, size_t current_test_index, size_t num_tests) = 0;
|
||||
virtual Vector<String> const* get_failed_test_names() const { return nullptr; }
|
||||
|
||||
String m_test_root;
|
||||
bool m_print_times;
|
||||
|
@ -101,7 +101,7 @@ inline double get_time_in_ms()
|
|||
}
|
||||
|
||||
template<typename Callback>
|
||||
inline void iterate_directory_recursively(const String& directory_path, Callback callback)
|
||||
inline void iterate_directory_recursively(String const& directory_path, Callback callback)
|
||||
{
|
||||
Core::DirIterator directory_iterator(directory_path, Core::DirIterator::Flags::SkipDots);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ void current_test_case_did_fail()
|
|||
}
|
||||
|
||||
// Declared in TestCase.h
|
||||
void add_test_case_to_suite(const NonnullRefPtr<TestCase>& test_case)
|
||||
void add_test_case_to_suite(NonnullRefPtr<TestCase> const& test_case)
|
||||
{
|
||||
TestSuite::the().add_case(test_case);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ void set_suite_setup_function(Function<void()> setup)
|
|||
TestSuite::the().set_suite_setup(move(setup));
|
||||
}
|
||||
|
||||
int TestSuite::main(const String& suite_name, int argc, char** argv)
|
||||
int TestSuite::main(String const& suite_name, int argc, char** argv)
|
||||
{
|
||||
m_suite_name = suite_name;
|
||||
|
||||
|
@ -65,7 +65,7 @@ int TestSuite::main(const String& suite_name, int argc, char** argv)
|
|||
bool do_tests_only = getenv("TESTS_ONLY") != nullptr;
|
||||
bool do_benchmarks_only = false;
|
||||
bool do_list_cases = false;
|
||||
const char* search_string = "*";
|
||||
char const* search_string = "*";
|
||||
|
||||
args_parser.add_option(do_tests_only, "Only run tests.", "tests", 0);
|
||||
args_parser.add_option(do_benchmarks_only, "Only run benchmarks.", "bench", 0);
|
||||
|
@ -76,11 +76,11 @@ int TestSuite::main(const String& suite_name, int argc, char** argv)
|
|||
if (m_setup)
|
||||
m_setup();
|
||||
|
||||
const auto& matching_tests = find_cases(search_string, !do_benchmarks_only, !do_tests_only);
|
||||
auto const& matching_tests = find_cases(search_string, !do_benchmarks_only, !do_tests_only);
|
||||
|
||||
if (do_list_cases) {
|
||||
outln("Available cases for {}:", suite_name);
|
||||
for (const auto& test : matching_tests) {
|
||||
for (auto const& test : matching_tests) {
|
||||
outln(" {}", test.name());
|
||||
}
|
||||
return 0;
|
||||
|
@ -91,10 +91,10 @@ int TestSuite::main(const String& suite_name, int argc, char** argv)
|
|||
return run(matching_tests);
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<TestCase> TestSuite::find_cases(const String& search, bool find_tests, bool find_benchmarks)
|
||||
NonnullRefPtrVector<TestCase> TestSuite::find_cases(String const& search, bool find_tests, bool find_benchmarks)
|
||||
{
|
||||
NonnullRefPtrVector<TestCase> matches;
|
||||
for (const auto& t : m_cases) {
|
||||
for (auto const& t : m_cases) {
|
||||
if (!search.is_empty() && !t.name().matches(search, CaseSensitivity::CaseInsensitive)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -111,22 +111,22 @@ NonnullRefPtrVector<TestCase> TestSuite::find_cases(const String& search, bool f
|
|||
return matches;
|
||||
}
|
||||
|
||||
int TestSuite::run(const NonnullRefPtrVector<TestCase>& tests)
|
||||
int TestSuite::run(NonnullRefPtrVector<TestCase> const& tests)
|
||||
{
|
||||
size_t test_count = 0;
|
||||
size_t test_failed_count = 0;
|
||||
size_t benchmark_count = 0;
|
||||
TestElapsedTimer global_timer;
|
||||
|
||||
for (const auto& t : tests) {
|
||||
const auto test_type = t.is_benchmark() ? "benchmark" : "test";
|
||||
for (auto const& t : tests) {
|
||||
auto const test_type = t.is_benchmark() ? "benchmark" : "test";
|
||||
|
||||
warnln("Running {} '{}'.", test_type, t.name());
|
||||
m_current_test_case_passed = true;
|
||||
|
||||
TestElapsedTimer timer;
|
||||
t.func()();
|
||||
const auto time = timer.elapsed_milliseconds();
|
||||
auto const time = timer.elapsed_milliseconds();
|
||||
|
||||
dbgln("{} {} '{}' in {}ms", m_current_test_case_passed ? "Completed" : "Failed", test_type, t.name(), time);
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ public:
|
|||
s_global = nullptr;
|
||||
}
|
||||
|
||||
int run(const NonnullRefPtrVector<TestCase>&);
|
||||
int main(const String& suite_name, int argc, char** argv);
|
||||
NonnullRefPtrVector<TestCase> find_cases(const String& search, bool find_tests, bool find_benchmarks);
|
||||
void add_case(const NonnullRefPtr<TestCase>& test_case)
|
||||
int run(NonnullRefPtrVector<TestCase> const&);
|
||||
int main(String const& suite_name, int argc, char** argv);
|
||||
NonnullRefPtrVector<TestCase> find_cases(String const& search, bool find_tests, bool find_benchmarks);
|
||||
void add_case(NonnullRefPtr<TestCase> const& test_case)
|
||||
{
|
||||
m_cases.append(test_case);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue