develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35604 - in trunk: . t/oo

From:
Whiteknight
Date:
January 15, 2009 14:28
Subject:
[svn:parrot] r35604 - in trunk: . t/oo
Message ID:
20090115222829.07DF2CB9AE@x12.develooper.com
Author: Whiteknight
Date: Thu Jan 15 14:28:28 2009
New Revision: 35604

Added:
   trunk/t/oo/vtableoverride.t
Modified:
   trunk/MANIFEST

Log:
[t] add a test for the new morph vtable override (actually, it's going to be for all vtable overrides, eventually)

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Thu Jan 15 14:28:28 2009
@@ -3356,6 +3356,7 @@
 t/oo/ops.t                                                  []
 t/oo/proxy.t                                                []
 t/oo/subclass.t                                             []
+t/oo/vtableoverride.t                                       []
 t/op/00ff-dos.t                                             []
 t/op/00ff-unix.t                                            []
 t/op/01-parse_ops.t                                         []

Added: trunk/t/oo/vtableoverride.t
==============================================================================
--- (empty file)
+++ trunk/t/oo/vtableoverride.t	Thu Jan 15 14:28:28 2009
@@ -0,0 +1,55 @@
+#! parrot
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: vtableoverride.t 35599 2009-01-10 02:01:58Z whiteknight $
+
+=head1 NAME
+
+t/oo/vtableoverride.t - test various vtable overrides from PIR
+
+=head1 SYNOPSIS
+
+    % prove t/oo/vtableoverride.t
+
+=head1 DESCRIPTION
+
+Tests the behavior of VTABLE interfaces that have been overriden from PIR.
+
+=cut
+
+.sub main :main
+    .include 'test_more.pir'
+    plan(2)
+    $P0 = newclass "MyObject"
+    $P1 = new $P0
+    
+    # Test get_string
+    $S0 = $P1
+    is($S0, "[MyObject]", "get_string VTABLE override")
+    
+    # Test morph (doesn't actually perform a morph)
+    morph $P1, "String"
+
+.end
+
+.namespace [ 'MyObject' ]
+
+.sub 'get_string' :vtable
+    $S0 = "[MyObject]"
+    .return($S0)
+.end
+
+.sub 'morph' :vtable
+    .param string type
+    $S0 = self
+    $S1 = "Morphing " . $S0
+    $S1 = $S1 . " to type "
+    $S1 = $S1 . type
+    is($S1, "Morphing [MyObject] to type String", "Morph vtable override")
+.end
+    
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About