<commit_before>#! /usr/local/bin/parrot
# Copyright (C) 2006-2009, Parrot Foundation.

=head1 WMLScript Pragmas

=head2 Synopsis

    % parrot t/pragmas.t

=head2 Description

=cut

.sub 'main' :main
    load_bytecode 't/helpers.pir'

    .include 'test_more.pir'

    plan(5)

    test_hello()
    test_use_url()
    test_unable_to_load()
    test_verification_failed()
    test_external_function_not_found()
.end

.sub 'test_hello'
     $S0 = <<'CODE'
extern function hello()
{
    Console.println("Hello World!");
}

extern function main()
{
    hello();
}
CODE
    wmls_is($S0, <<'OUT', "hello")
Hello World!
OUT
.end

.sub 'test_use_url'
     $S0 = <<'CODE'
use url OtherScript "test_1.wmlsc";

extern function main()
{
    OtherScript#hello();
}
CODE
    wmls_is($S0, <<'OUT', "use url")
Hello World!
OUT
.end

.sub 'test_unable_to_load'
     $S0 = <<'CODE'
use url OtherScript "test_x.wmlsc";

extern function main()
{
    OtherScript#hello();
}
CODE
#    wmls_like($S0, "unable to load", "unable to load")
    wmls_like($S0, "unable", "unable to load")
.end

.sub 'test_verification_failed'
     $S0 = <<'CODE'
use url OtherScript "test_1.wmls";

extern function main()
{
    OtherScript#hello();
}
CODE
#    wmls_like($S0, "verification failed", "verification failed")
    wmls_like($S0, "verification", "verification failed")
.end

.sub 'test_external_function_not_found'
     $S0 = <<'CODE'
use url OtherScript "test_1.wmlsc";

extern function main()
{
    OtherScript#hello2();
}
CODE
#    wmls_like($S0, "external function '\\w+' not found", "external function not found")
    wmls_like($S0, "found", "external function not found")
.end

# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:<commit_msg>better regex<commit_after>#! /usr/local/bin/parrot
# Copyright (C) 2006-2009, Parrot Foundation.

=head1 WMLScript Pragmas

=head2 Synopsis

    % parrot t/pragmas.t

=head2 Description

=cut

.sub 'main' :main
    load_bytecode 't/helpers.pir'

    .include 'test_more.pir'

    plan(5)

    test_hello()
    test_use_url()
    test_unable_to_load()
    test_verification_failed()
    test_external_function_not_found()
.end

.sub 'test_hello'
     $S0 = <<'CODE'
extern function hello()
{
    Console.println("Hello World!");
}

extern function main()
{
    hello();
}
CODE
    wmls_is($S0, <<'OUT', "hello")
Hello World!
OUT
.end

.sub 'test_use_url'
     $S0 = <<'CODE'
use url OtherScript "test_1.wmlsc";

extern function main()
{
    OtherScript#hello();
}
CODE
    wmls_is($S0, <<'OUT', "use url")
Hello World!
OUT
.end

.sub 'test_unable_to_load'
     $S0 = <<'CODE'
use url OtherScript "test_x.wmlsc";

extern function main()
{
    OtherScript#hello();
}
CODE
    wmls_like($S0, ":s unable to load", "unable to load")
.end

.sub 'test_verification_failed'
     $S0 = <<'CODE'
use url OtherScript "test_1.wmls";

extern function main()
{
    OtherScript#hello();
}
CODE
    wmls_like($S0, ":s verification failed", "verification failed")
.end

.sub 'test_external_function_not_found'
     $S0 = <<'CODE'
use url OtherScript "test_1.wmlsc";

extern function main()
{
    OtherScript#hello2();
}
CODE
#    wmls_like($S0, "external function '\\w+' not found", "external function not found")
    wmls_like($S0, ":s not found", "external function not found")
.end

# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
{'fraction_non_alphanumeric': 0.1485264079369711, 'fraction_numerical': 0.018675226145316602, 'mean_word_length': 3.8486562942008486, 'pattern_counts': {'":': 3, '<': 31, '<?xml version=': 0, '>': 3, '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': '4364839', 'n_tokens_mistral': 1368, 'n_tokens_neox': 1318, 'n_words': 321}