| 1 | #!./parrot |
|---|
| 2 | # Copyright (C) 2009, The Perl Foundation. |
|---|
| 3 | |
|---|
| 4 | =head1 NAME |
|---|
| 5 | |
|---|
| 6 | t/library/tcl_lib.t - test parrot to external Tcl connection |
|---|
| 7 | |
|---|
| 8 | =head1 SYNOPSIS |
|---|
| 9 | |
|---|
| 10 | % prove t/library/tcl_lib.t |
|---|
| 11 | |
|---|
| 12 | =head1 DESCRIPTION |
|---|
| 13 | |
|---|
| 14 | =cut |
|---|
| 15 | |
|---|
| 16 | .const int TESTS = 1 |
|---|
| 17 | |
|---|
| 18 | .sub 'main' :main |
|---|
| 19 | load_bytecode 'library/Test/More.pbc' |
|---|
| 20 | |
|---|
| 21 | .local pmc exports, curr_namespace, test_namespace |
|---|
| 22 | curr_namespace = get_namespace |
|---|
| 23 | test_namespace = get_namespace [ 'Test'; 'More' ] |
|---|
| 24 | exports = split ' ', 'plan diag ok nok is is_deeply like isa_ok skip isnt todo' |
|---|
| 25 | |
|---|
| 26 | test_namespace.'export_to'(curr_namespace, exports) |
|---|
| 27 | |
|---|
| 28 | plan(TESTS) |
|---|
| 29 | |
|---|
| 30 | load_bytecode 'TclLibrary.pir' # TBD pbc |
|---|
| 31 | 'ok'(1, 'loaded TclLibrary') |
|---|
| 32 | |
|---|
| 33 | goto skip_all # this is TEMPORARY untill the case of missing libtcl is fixed |
|---|
| 34 | |
|---|
| 35 | .local pmc tcl |
|---|
| 36 | tcl = new 'TclLibrary' |
|---|
| 37 | 'ok'(1, 'created instance') |
|---|
| 38 | |
|---|
| 39 | .local string res |
|---|
| 40 | .local int ires |
|---|
| 41 | res = tcl.'eval'("return {3+3}") |
|---|
| 42 | 'is'(res, '3+3', 'return of a string') |
|---|
| 43 | # TODO res = tcl.'eval'("return [list a b foo bar]") |
|---|
| 44 | ires = tcl.'eval'("expr {3+3}") |
|---|
| 45 | 'is'(ires, 6, 'return of an integer') |
|---|
| 46 | res = tcl.'eval'("return [expr 1.0]") |
|---|
| 47 | 'is'(res, '1.0', 'return of double') |
|---|
| 48 | |
|---|
| 49 | skip_all: |
|---|
| 50 | |
|---|
| 51 | .end |
|---|
| 52 | # Local Variables: |
|---|
| 53 | # mode: pir |
|---|
| 54 | # fill-column: 100 |
|---|
| 55 | # End: |
|---|
| 56 | # vim: expandtab shiftwidth=4 ft=pir: |
|---|
| 57 | |
|---|