From 6ccd57e1b7ede64072758c6f4cb6fcefa66c74cf Mon Sep 17 00:00:00 2001 From: Bernhard Schmalhofer Date: Tue, 24 Mar 2009 21:34:57 +0100 Subject: [PATCH] add a couple of PMC tests --- t/pmc/boolean.t | 19 +++++++++++++++++-- t/pmc/null.t | 15 +++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/t/pmc/boolean.t b/t/pmc/boolean.t index 77476b9..a656143 100644 --- a/t/pmc/boolean.t +++ b/t/pmc/boolean.t @@ -1,4 +1,3 @@ -#! ../../parrot # Copyright (C) 2008, The Perl Foundation. =head1 NAME @@ -20,9 +19,10 @@ Tests C PMC. .include "test_more.pir" - plan(2) + plan(5) truth_tests() + type_tests() .end .sub truth_tests @@ -38,6 +38,21 @@ Tests C PMC. is(false, "", "false PhpBoolean is empty") .end +.sub type_tests + .local pmc true, false + .local string true_type, false_type + + true = new 'PhpBoolean' + true = 1 + true_type = typeof true + is(true_type, "boolean", "type of true") + + false = new 'PhpBoolean' + false = 0 + false_type = typeof false + is(false_type, "boolean", "type of false") +.end + # Local Variables: # mode: pir # cperl-indent-level: 4 diff --git a/t/pmc/null.t b/t/pmc/null.t index 75f54f4..f9f8086 100644 --- a/t/pmc/null.t +++ b/t/pmc/null.t @@ -1,4 +1,3 @@ -#! ../../parrot # Copyright (C) 2008, The Perl Foundation. =head1 NAME @@ -20,10 +19,11 @@ Tests C PMC. .include "test_more.pir" - plan(2) + plan(3) truth_tests() stringification_tests() + type_tests() .end .sub truth_tests @@ -43,6 +43,17 @@ Tests C PMC. s = null_value is_ok = s == '' ok( is_ok, 'stringification' ) + is( null_value, '', 'stringification with is()' ) +.end + +.sub type_tests + .local pmc null_value + .local string null_type + + null_value = new 'PhpNull' + + null_type = typeof null_value + is(null_type, "NULL", "type of null") .end # Local Variables: