<commit_before>#!/usr/bin/env perl
use strict;
use warnings;
use v5.10;

my $path = "./icarus";

die "Could not find '$path'\n" unless -e $path;

my $input = <<EOF;
fn main()
    let name = "Jennifer"
    println(concat(concat("Hello there ", name), ", very nice to meet you"))
end
EOF

my $expected = <<EOF;
Hello there Jennifer, very nice to meet you
EOF

my $in_tmp_file = `mktemp TESTING_BACKEND_2C_SIMPLE_XXX.ic`;
chomp($in_tmp_file);
open( my $fh, ">", "$in_tmp_file" ) or die "failed to open tmp file '$in_tmp_file'";
print $fh $input;
close $fh;

# using mktemp here just to get name
my $out_tmp_file = `mktemp TESTING_BACKEND_2C_SIMPLE_XXX.c`;
# have to remove right away, as icarus 2c wants to create
`rm $out_tmp_file`;

# compile .ic to .c
my $output = `$path $in_tmp_file 2c $out_tmp_file`;
my $exit_status = $?;

`rm $in_tmp_file`;<commit_msg>updating test_backend_2c_simple to also cover return<commit_after>#!/usr/bin/env perl
use strict;
use warnings;
use v5.10;

my $path = "./icarus";

die "Could not find '$path'\n" unless -e $path;

my $input = <<EOF;
fn get_str() -> String
    let name = "Jennifer"
    return concat(concat("Hello there ", name), ", very nice to meet you")
end

fn main()
  println(get_str())
end
EOF

my $expected = <<EOF;
Hello there Jennifer, very nice to meet you
EOF

my $in_tmp_file = `mktemp TESTING_BACKEND_2C_SIMPLE_XXX.ic`;
chomp($in_tmp_file);
open( my $fh, ">", "$in_tmp_file" ) or die "failed to open tmp file '$in_tmp_file'";
print $fh $input;
close $fh;

# using mktemp here just to get name
my $out_tmp_file = `mktemp TESTING_BACKEND_2C_SIMPLE_XXX.c`;
# have to remove right away, as icarus 2c wants to create
`rm $out_tmp_file`;

# compile .ic to .c
my $output = `$path $in_tmp_file 2c $out_tmp_file`;
my $exit_status = $?;

`rm $in_tmp_file`;
{'fraction_non_alphanumeric': 0.1388888888888889, 'fraction_numerical': 0.008333333333333333, 'mean_word_length': 4.610591900311526, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5305915', 'n_tokens_mistral': 735, 'n_tokens_neox': 701, 'n_words': 228}