Skip to content

Commit

Permalink
Added test function to compare syntax trees
Browse files Browse the repository at this point in the history
  • Loading branch information
sebasguts committed Mar 21, 2019
1 parent 4e5f52e commit 9fa7002
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tst/testinstall/syntaxtree.tst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ gap> SyntaxTree(x -> x);
gap> SyntaxTree(\+);
Error, SYNTAX_TREE: <func> must be a plain GAP function (not a function)

gap> test_tree := function( f )
> local curr_tree, new_func, new_tree;
> curr_tree := SYNTAX_TREE( f );
> new_func := SYNTAX_TREE_CODE( curr_tree );
> new_tree := SYNTAX_TREE( new_func );
> return new_tree = curr_tree;
> end;;

# Just try compiling all functions we can find in the workspace
# to see nothing crashes.
gap> for n in NamesGVars() do
Expand All @@ -37,8 +45,7 @@ gap> testit := function(f)
> local tree;
> tree := SYNTAX_TREE(f);
> Display(tree);
> # TODO: recode the tree, then decode again and compare
> return true;
> return test_tree( f );
> end;;

# T_PROCCALL_0ARGS
Expand Down

0 comments on commit 9fa7002

Please sign in to comment.