Skip to content

Commit 3e0e12e

Browse files
author
thk123
committed
Adding tests for the other two returning lambdas that don't capture
1 parent f3ddee6 commit 3e0e12e

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

unit/java_bytecode/java_bytecode_convert_method/convert_invoke_dynamic.cpp

+42
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,48 @@ SCENARIO(
232232
test_data.should_return_value = true;
233233
validate_lamdba_assignement(symbol_table, instructions, test_data);
234234
}
235+
THEN(
236+
"The local variable should be assigned a temp object implementing "
237+
"ReturningLambdaReference")
238+
{
239+
lambda_assignment_test_datat test_data;
240+
241+
test_data.lambda_variable_id = std::regex(
242+
function_prefix_regex_str + "::\\d+::returnReferenceLambda");
243+
244+
test_data.lambda_interface = "java::ReturningLambdaReference";
245+
246+
test_data.lambda_interface_method_descriptor =
247+
".Execute:()Ljava/lang/Object;";
248+
249+
//"java::LocalLambdas.lambda$test$0:()V"
250+
test_data.lambda_function_id =
251+
"java::LocalLambdas.lambda$test$4:()Ljava/lang/Object;";
252+
test_data.expected_params = {};
253+
test_data.should_return_value = true;
254+
validate_lamdba_assignement(symbol_table, instructions, test_data);
255+
}
256+
THEN(
257+
"The local variable should be assigned a temp object implementing "
258+
"ReturningLambdaSpecalisedGeneric")
259+
{
260+
lambda_assignment_test_datat test_data;
261+
262+
test_data.lambda_variable_id = std::regex(
263+
function_prefix_regex_str +
264+
"::\\d+::returningSpecalisedGenericLambda");
265+
266+
test_data.lambda_interface = "java::ReturningLambdaSpecalisedGeneric";
267+
268+
test_data.lambda_interface_method_descriptor =
269+
".Execute:()LDummyGeneric;";
270+
test_data.lambda_function_id =
271+
"java::LocalLambdas.lambda$test$5:()LDummyGeneric;";
272+
test_data.expected_params = {};
273+
test_data.should_return_value = true;
274+
validate_lamdba_assignement(symbol_table, instructions, test_data);
275+
}
276+
// TODO[TG-2482]: Tests for local lambdas that capture variables
235277
}
236278
}
237279
});

0 commit comments

Comments
 (0)