#!/usr/bin/env perl
use strict;
plan tests => 1;
{
my $js = JavaScript::Writer->new;
$js->object(1)->do(sub { $_[0]->alert(42) });
is "$js", "if(1){alert(42);}"
}