|
|
@ -205,14 +205,14 @@ sub generate_key_addrs {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sub generate_start_new_test {
|
|
|
|
sub generate_start_new_test {
|
|
|
|
my $entry = shift;
|
|
|
|
my $name = shift;
|
|
|
|
my $name = $entry->{data}->{test_name};
|
|
|
|
|
|
|
|
if ($inside_test) {
|
|
|
|
if ($inside_test) {
|
|
|
|
generate_end_test();
|
|
|
|
generate_end_test();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cxx( "TEST_F(" . $test_class . "," . $name . ") {" );
|
|
|
|
cxx( "TEST_F(" . $test_class . "," . $name . ") {" );
|
|
|
|
$inside_test = 1;
|
|
|
|
$inside_test = 1;
|
|
|
|
indent();
|
|
|
|
indent();
|
|
|
|
|
|
|
|
cxx("ClearState(); // Clear any state from previous tests");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sub generate_end_test {
|
|
|
|
sub generate_end_test {
|
|
|
|
if ($reports_expected) {
|
|
|
|
if ($reports_expected) {
|
|
|
@ -220,11 +220,24 @@ sub generate_end_test {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
outdent();
|
|
|
|
outdent();
|
|
|
|
cxx("} // TEST_F");
|
|
|
|
cxx("} // TEST_F");
|
|
|
|
|
|
|
|
cxx('');
|
|
|
|
|
|
|
|
cxx('');
|
|
|
|
|
|
|
|
cxx('');
|
|
|
|
$inside_test = 0;
|
|
|
|
$inside_test = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub generate_script {
|
|
|
|
sub generate_script {
|
|
|
|
cxx_section("Test script");
|
|
|
|
cxx_section("Test script");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Super evil hack from https://stackoverflow.com/a/48924764
|
|
|
|
|
|
|
|
# We should do this better, inside the core. But until we do
|
|
|
|
|
|
|
|
# I'd rather stick the macro in the code generator so nobody
|
|
|
|
|
|
|
|
# gets to use it from regular tests, boxing us in
|
|
|
|
|
|
|
|
cxx('#define GTEST_COUT std::cerr << "[ INFO ] "');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
generate_start_new_test('KtestSourceFilename');
|
|
|
|
|
|
|
|
cxx("GTEST_COUT << \"test: @{[File::Spec->rel2abs( $text_filename ) ]}\" << std::endl;");
|
|
|
|
|
|
|
|
generate_end_test('');
|
|
|
|
|
|
|
|
|
|
|
|
$reports_expected = 0;
|
|
|
|
$reports_expected = 0;
|
|
|
|
for my $entry (@script_lines) {
|
|
|
|
for my $entry (@script_lines) {
|
|
|
@ -234,7 +247,7 @@ sub generate_script {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ( my $action = $entry->{action} ) {
|
|
|
|
elsif ( my $action = $entry->{action} ) {
|
|
|
|
|
|
|
|
|
|
|
|
if ( $action eq 'name' ) { generate_start_new_test($entry) }
|
|
|
|
if ( $action eq 'name' ) { generate_start_new_test($entry->{data}->{test_name}) }
|
|
|
|
elsif ( !$inside_test && defined $action ) {
|
|
|
|
elsif ( !$inside_test && defined $action ) {
|
|
|
|
die "Attempting to run an action '$action' when not inside a test section on line " . $entry->{line_num} . "\n";
|
|
|
|
die "Attempting to run an action '$action' when not inside a test section on line " . $entry->{line_num} . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -297,10 +310,8 @@ sub generate_expect_report {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub generate_check_expected_reports {
|
|
|
|
sub generate_check_expected_reports {
|
|
|
|
cxx("");
|
|
|
|
|
|
|
|
cxx("");
|
|
|
|
cxx("");
|
|
|
|
cxx("CHECK_EXPECTED_REPORTS();");
|
|
|
|
cxx("CHECK_EXPECTED_REPORTS();");
|
|
|
|
cxx("");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub generate_preface {
|
|
|
|
sub generate_preface {
|
|
|
|