Skip to content

Commit 03be093

Browse files
committed
maybe const ref
1 parent 5fdc8f5 commit 03be093

File tree

11 files changed

+18
-18
lines changed

11 files changed

+18
-18
lines changed

tests/unittests/Suites/CompilerSuite.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ut::suite<"Compiler"> compiler_suite = [] {
8181

8282
iterTestFiles(
8383
"CompilerSuite/ir",
84-
[](TestData&& data) {
84+
[](const TestData& data) {
8585
Ark::Welder welder(0, { lib_path }, features);
8686

8787
should("compile without error ir/" + data.stem) = [&] {
@@ -103,7 +103,7 @@ ut::suite<"Compiler"> compiler_suite = [] {
103103

104104
iterTestFiles(
105105
"CompilerSuite/optimized_ir",
106-
[](TestData&& data) {
106+
[](const TestData& data) {
107107
Ark::Welder welder(0, { lib_path }, features);
108108

109109
should("compile without error optimized_ir/" + data.stem) = [&] {

tests/unittests/Suites/DiagnosticsSuite.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ut::suite<"Diagnostics"> diagnostics_suite = [] {
1414

1515
iterTestFiles(
1616
"DiagnosticsSuite/compileTime",
17-
[](TestData&& data) {
17+
[](const TestData& data) {
1818
Ark::State state({ lib_path });
1919

2020
should("generate an error message at compile time for compileTime/" + data.stem) = [&] {
@@ -36,7 +36,7 @@ ut::suite<"Diagnostics"> diagnostics_suite = [] {
3636

3737
iterTestFiles(
3838
"DiagnosticsSuite/runtime",
39-
[](TestData&& data) {
39+
[](const TestData& data) {
4040
Ark::State state({ lib_path });
4141

4242
should("compile without error runtime/" + data.stem) = [&] {
@@ -62,7 +62,7 @@ ut::suite<"Diagnostics"> diagnostics_suite = [] {
6262

6363
iterTestFiles(
6464
"DiagnosticsSuite/typeChecking",
65-
[](TestData&& data) {
65+
[](const TestData& data) {
6666
Ark::State state({ lib_path });
6767

6868
should("compile without error typeChecking/" + data.stem) = [&] {

tests/unittests/Suites/FormatterSuite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ut::suite<"Formatter"> formatter_suite = [] {
1111

1212
iterTestFiles(
1313
"FormatterSuite",
14-
[](TestData&& data) {
14+
[](const TestData& data) {
1515
std::string formatted_code;
1616

1717
should("output a correctly formatted code for " + data.stem) = [&] {

tests/unittests/Suites/OptimizerSuite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ut::suite<"Optimizer"> optimizer_suite = [] {
1313
"[generate optimized ast]"_test = [] {
1414
iterTestFiles(
1515
"OptimizerSuite",
16-
[](TestData&& data) {
16+
[](const TestData& data) {
1717
JsonCompiler compiler(false, { lib_path }, Ark::FeatureASTOptimizer);
1818

1919
std::string json;

tests/unittests/Suites/ParserSuite.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ut::suite<"Parser"> parser_suite = [] {
4646
"[successful parsing]"_test = [] {
4747
iterTestFiles(
4848
"ParserSuite/success",
49-
[](TestData&& data) {
49+
[](const TestData& data) {
5050
Ark::internal::Parser parser(/* debug= */ 0);
5151

5252
should("parse " + data.stem) = [&] {
@@ -68,7 +68,7 @@ ut::suite<"Parser"> parser_suite = [] {
6868
"[error reporting]"_test = [] {
6969
iterTestFiles(
7070
"ParserSuite/failure",
71-
[](TestData&& data) {
71+
[](const TestData& data) {
7272
try
7373
{
7474
Ark::internal::Parser parser(/* debug= */ 0);

tests/unittests/Suites/RosettaSuite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ut::suite<"Rosetta"> rosetta_suite = [] {
1313
"[run arkscript rosetta code solutions]"_test = [] {
1414
iterTestFiles(
1515
"RosettaSuite",
16-
[](TestData&& data) {
16+
[](const TestData&data) {
1717
Ark::State state({ lib_path });
1818

1919
should("compile " + data.stem) = [&] {

tests/unittests/Suites/TypeCheckerSuite.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,15 @@ ut::suite<"TypeChecker"> type_checker_suite = [] {
177177

178178
iterTestFiles(
179179
"TypeCheckerSuite",
180-
[&](TestData&& data) {
180+
[&](const TestData& data) {
181181
std::vector<Input> inputs;
182182
std::vector<Ark::types::Contract> contracts;
183183

184184
if (data.is_folder)
185185
{
186186
iterTestFiles(
187187
data.path,
188-
[&inputs](TestData&& inner) {
188+
[&inputs](const TestData& inner) {
189189
const Input input = parse_input(inner.path);
190190
expect(fatal(input.initialized)) << "invalid test input: " << inner.stem;
191191
inputs.push_back(input);

tests/unittests/Suites/ValidAstSuite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ut::suite<"AST"> ast_suite = [] {
1313
"[generate valid ast]"_test = [] {
1414
iterTestFiles(
1515
"ASTSuite",
16-
[](TestData&& data) {
16+
[](const TestData& data) {
1717
JsonCompiler compiler(false, { lib_path });
1818

1919
std::string json;

tests/unittests/TestsHelper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void updateExpectedFile(const TestData& data, const std::string& actual)
2828
}
2929
}
3030

31-
void iterTestFiles(const std::string& folder, std::function<void(TestData&&)>&& test, IterTestFilesParam&& params)
31+
void iterTestFiles(const std::string& folder, std::function<void(const TestData&)>&& test, IterTestFilesParam&& params)
3232
{
3333
boost::ut::test(folder) = [&] {
3434
const auto path = params.folder_is_resource ? getResourcePath(folder) : folder;
@@ -58,8 +58,8 @@ void iterTestFiles(const std::string& folder, std::function<void(TestData&&)>&&
5858
.is_folder = is_directory(entry.path())
5959
};
6060

61-
std::cout << "test on '" << entry.path().generic_string() << std::endl;
62-
test(std::move(data));
61+
std::cout << "test on '" << entry.path().generic_string() << "'" << std::endl;
62+
test(data);
6363
}
6464
};
6565
}

0 commit comments

Comments
 (0)