Author: coke
Date: Fri Aug  5 08:36:59 2005
New Revision: 8821

Modified:
   trunk/languages/tcl/lib/commands/puts.pir
   trunk/languages/tcl/t/cmd_puts.t
Log:
fix bug with [puts], add tests for arguments,
change puts.t to saner syntax.



Modified: trunk/languages/tcl/lib/commands/puts.pir
==============================================================================
--- trunk/languages/tcl/lib/commands/puts.pir   (original)
+++ trunk/languages/tcl/lib/commands/puts.pir   Fri Aug  5 08:36:59 2005
@@ -81,6 +81,7 @@ bad_option:
  
 error:
   return_type = TCL_ERROR
+  retval = new String
   retval = "wrong # args: should be \"puts ?-nonewline? ?channelId? string\""
   goto done
 

Modified: trunk/languages/tcl/t/cmd_puts.t
==============================================================================
--- trunk/languages/tcl/t/cmd_puts.t    (original)
+++ trunk/languages/tcl/t/cmd_puts.t    Fri Aug  5 08:36:59 2005
@@ -2,21 +2,31 @@
 
 use strict;
 use lib qw(tcl/t t . ../lib ../../lib ../../../lib);
-use Parrot::Test tests => 2;
+use Parrot::Test tests => 4;
 use Test::More;
 
-my($tcl,$expected);
+# TODO:  Missing channelId tests.
 
-$tcl = <<'EOTCL';
- puts -nonewline "whee"
-EOTCL
-$expected = "whee";
-language_output_is("tcl",$tcl,$expected,"nonewline");
-
-$tcl = <<'EOTCL';
- puts "whee"
-EOTCL
-$expected = "whee\n";
-language_output_is("tcl",$tcl,$expected,"with newline");
+language_output_is("tcl",<<'TCL',<<OUT,"no args");
+ puts
+TCL
+wrong # args: should be "puts ?-nonewline? ?channelId? string"
+OUT
 
-# XXX Missing channelId tests.
+language_output_is("tcl",<<'TCL',<<OUT,"too many args");
+ puts a b c d
+TCL
+wrong # args: should be "puts ?-nonewline? ?channelId? string"
+OUT
+
+language_output_is("tcl",<<'TCL',<<OUT,"-nonewline");
+  puts -nonewline whee\n
+TCL
+whee
+OUT
+
+language_output_is("tcl",<<'TCL',<<OUT,"normal");
+ puts whee
+TCL
+whee
+OUT

Reply via email to