From cbf36960fcb731d1f77448f1eee9fb4cec299261 Mon Sep 17 00:00:00 2001 From: Gisle Aas Date: Sat, 28 Nov 2009 17:21:40 +0100 Subject: [PATCH] Ensure clean callbacks with newest Tcl.pm --- MANIFEST | 1 + Makefile.PL | 2 +- t/tcl-callback.t | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 t/tcl-callback.t diff --git a/MANIFEST b/MANIFEST index e65b011..ea148e5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -8,6 +8,7 @@ t/mega.t t/mega-config.t t/nul-char.t t/tcl.t +t/tcl-callback.t t/tk.t t/utf8.t tkx-ed diff --git a/Makefile.PL b/Makefile.PL index 92a2c71..f074809 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -8,7 +8,7 @@ WriteMakefile( VERSION_FROM => 'Tkx.pm', ABSTRACT_FROM => 'Tkx.pm', PREREQ_PM => { - Tcl => 0.81, + Tcl => 0.98, }, AUTHOR => 'Gisle Aas ', EXE_FILES => [qw(tkx-ed tkx-prove)], diff --git a/t/tcl-callback.t b/t/tcl-callback.t new file mode 100644 index 0000000..25aa2f1 --- /dev/null +++ b/t/tcl-callback.t @@ -0,0 +1,27 @@ +#!perl -w + +use strict; +use Test; + +plan tests => 7; + +use Tkx qw(set after); + +set("foo", sub { + ok @_, 2; + ok "@_", "a b c"; +}); +ok set("foo"), qr/^::perl::CODE\(0x/; +Tkx::eval('[set foo] a {b c}'); + +set("foo", [sub { + ok @_, 4; + ok "@_", "a b c d e f"; +}, "d", "e f"]); +Tkx::eval('[set foo] a {b c}'); + +set("foo", [sub { + ok @_, 6; + ok "@_", "2 3 a b c d"; +}, Tkx::Ev('[expr 1+1]', '[expr 1+2]'), "c", "d"]); +Tkx::eval('eval [set foo] a b');