#!/usr/bin/env perl # Copyright (c) 2014-2015 Christian Jaeger, copying@christianjaeger.ch # This is free software. See the file COPYING.md that came bundled # with this file. use strict; use warnings; use warnings FATAL => 'uninitialized'; our ($mydir, $myname); BEGIN { $0 =~ /(.*?)([^\/]+)\z/s or die "?"; ($mydir, $myname) = ($1, $2); } use lib "$mydir/../../lib"; use Chj::TEST ":all"; use PXML::XHTML ":all"; use PXML::Serialize "pxml_print_fragment_fast"; use FP::Lazy; use FP::List; use FP::Stream; use FP::Array ":all"; # XXX inconsistency in export directives use FP::PureArray; TEST_STDOUT { pxml_print_fragment_fast(A({ href => "hah" }, "Hello ", I("World", B("!"))), *STDOUT{IO}) } 'Hello World!'; TEST { A( { href => "hah" }, "Hello ", I("World", undef, B("!")), cons(" ", string_to_stream("You're great.")) )->text } 'Hello World! You\'re great.'; TEST { P(list)->string } '

'; TEST { P(list 1, 2, B(3))->string } '

123

'; TEST { P(stream 1, 2, lazy { B(3) })->string } '

123

'; TEST { P(array 1, 2, B(3))->string } '

123

'; TEST { P(purearray 1, 2, B(3))->string } '

123

'; TEST { P(cons "Hello", "World")->string } '

HelloWorld

'; TEST { P(cons I("Hello"), B(cons null, "World"))->string } '

HelloWorld

'; use Chj::Backtrace; perhaps_run_tests(__PACKAGE__) or do { require FP::Repl; FP::Repl::repl(); };