Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active September 27, 2016 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/4aeeed6a2bdfc0a5efa481a25a16f32b to your computer and use it in GitHub Desktop.
Save dogbert17/4aeeed6a2bdfc0a5efa481a25a16f32b to your computer and use it in GitHub Desktop.
Attempt to write tests for roast
use v6;
use Test;
plan 2;
=begin description
This test tests C<duckmap>.
=end description
{
my $list = (1, (2,3), "a");
is-deeply duckmap(-> Int $x { $x ~~ Int ?? $x !! Any }, $list), (1, (2, 3), 'a'), "duckmap doesn't hang"; # RT #129321
#?rakudo todo "RT #129363 duckmap doesn't preserve structure types"
my @arr = [1, [2,3], 4];
is-deeply duckmap(-> Int $x { $x ~~ Int ?? $x !! Any }, @arr).WHAT, Array, "duckmap preserves structure types";
} #2
# vim: ft=perl6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment