Skip to content

Commit

Permalink
add implementation and test of name()
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Mar 23, 2009
1 parent 41012b4 commit 4a8ed6d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/pmc/eclectusboolean.pmc
Expand Up @@ -29,9 +29,24 @@ pmclass EclectusBoolean
hll Eclectus
maps Boolean {


/*

=item C<STRING* name()>

Return the string "boolean".

=cut

*/
VTABLE STRING* name() {
return Parrot_str_new_constant(INTERP, "EclectusBool");
}


=item C<STRING* get_string()>

Return the string '1' or ''.
Return the string '#t' or '#f'.

=cut

Expand Down
17 changes: 16 additions & 1 deletion t/pmc/boolean.t
Expand Up @@ -18,9 +18,10 @@ Tests C<EclectusBoolean> PMC.

.include "test_more.pir"

plan(4)
plan(6)

truth_tests()
type_tests()
exit 0

LOADING_FAILED:
Expand All @@ -44,6 +45,20 @@ Tests C<EclectusBoolean> PMC.
is(false, "#f", "false EclectusBoolean is #f")
.end

.sub type_tests
.local pmc true, false
.local string true_type, false_type
true = new 'EclectusBoolean'
true = 1
true_type = typeof true
is(true_type, "EclectusBool", "type of true")

false = new 'EclectusBoolean'
false = 0
false_type = typeof false
is(false_type, "EclectusBool", "type of false")
.end

# Local Variables:
# mode: pir
# cperl-indent-level: 4
Expand Down

0 comments on commit 4a8ed6d

Please sign in to comment.