Skip to content

Commit

Permalink
add a couple of PMC tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Mar 24, 2009
1 parent 77600a6 commit 6ccd57e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
19 changes: 17 additions & 2 deletions t/pmc/boolean.t
@@ -1,4 +1,3 @@
#! ../../parrot
# Copyright (C) 2008, The Perl Foundation.

=head1 NAME
Expand All @@ -20,9 +19,10 @@ Tests C<PhpBoolean> PMC.

.include "test_more.pir"

plan(2)
plan(5)

truth_tests()
type_tests()
.end

.sub truth_tests
Expand All @@ -38,6 +38,21 @@ Tests C<PhpBoolean> 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
Expand Down
15 changes: 13 additions & 2 deletions t/pmc/null.t
@@ -1,4 +1,3 @@
#! ../../parrot
# Copyright (C) 2008, The Perl Foundation.

=head1 NAME
Expand All @@ -20,10 +19,11 @@ Tests C<PhpNull> PMC.

.include "test_more.pir"

plan(2)
plan(3)

truth_tests()
stringification_tests()
type_tests()
.end

.sub truth_tests
Expand All @@ -43,6 +43,17 @@ Tests C<PhpNull> 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:
Expand Down

0 comments on commit 6ccd57e

Please sign in to comment.