Skip to content

Commit

Permalink
[master] confirm excess parentheses cannot be elided (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhrr committed Apr 16, 2015
1 parent f5bfb33 commit 3b9bf7b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
25 changes: 25 additions & 0 deletions t/002macro/019extra-parens.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/perl

use warnings;
use strict;
$ENV{"DALE_TEST_ARGS"} ||= "";
my $test_dir = $ENV{"DALE_TEST_DIR"} || ".";
$ENV{PATH} .= ":.";

use Data::Dumper;
use Test::More tests => 3;

my @res = `dalec $ENV{"DALE_TEST_ARGS"} $test_dir/t/src/extra-parens.dt -o extra-parens `;
is_deeply(\@res, [], 'No compilation errors');
@res = `./extra-parens`;
is($?, 0, 'Program executed successfully');

chomp for @res;

is_deeply(\@res, [ 'extra parens'
],
'Got correct results');

`rm extra-parens`;

1;
10 changes: 10 additions & 0 deletions t/src/extra-parens.dt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(import macros)

; For confirming that a macro may return a form like ((second)), where
; (second) expands in turn to some other form.

(using-namespace std.macros
(def first (macro intern (void) (qq (second))))
(def second (macro intern (void) (mnfv mc "third")))
(def third (fn intern int (void) (printf "extra parens\n")))
(def main (fn extern-c int (void) (first) 0)))

0 comments on commit 3b9bf7b

Please sign in to comment.