From 8a9870ed59225972de389b7b4a494a57390bff1b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 9 Sep 2015 14:51:48 +0200 Subject: Add initial support for function calls: $func(a b c) Now it is just a stub that prints the function name and its argument. Currently only single argument can be passed (no value pack support yet). --- tests/eval/buildfile | 1 + tests/function/call/buildfile | 15 +++++++++++++++ tests/function/call/test.out | 7 +++++++ tests/function/call/test.sh | 3 +++ 4 files changed, 26 insertions(+) create mode 100644 tests/function/call/buildfile create mode 100644 tests/function/call/test.out create mode 100755 tests/function/call/test.sh (limited to 'tests') diff --git a/tests/eval/buildfile b/tests/eval/buildfile index c658d3b..cf315b6 100644 --- a/tests/eval/buildfile +++ b/tests/eval/buildfile @@ -1,4 +1,5 @@ (./): +() # Invalid. # diff --git a/tests/function/call/buildfile b/tests/function/call/buildfile new file mode 100644 index 0000000..93eba14 --- /dev/null +++ b/tests/function/call/buildfile @@ -0,0 +1,15 @@ +$identity() +$identity (a) +$identity (a b c) +$identity(sub/dir{x y z}) + +# Verify we can inhibit function call with quoting. +# +foo = FOO +bar = BAR + +print $foo"($bar)" +print "$foo"($bar) +print "$foo""($bar)" + +./: diff --git a/tests/function/call/test.out b/tests/function/call/test.out new file mode 100644 index 0000000..abc5974 --- /dev/null +++ b/tests/function/call/test.out @@ -0,0 +1,7 @@ +identity() +identity(a) +identity(a b c) +identity(sub/dir{x} sub/dir{y} sub/dir{z}) +FOOBAR +FOOBAR +FOOBAR diff --git a/tests/function/call/test.sh b/tests/function/call/test.sh new file mode 100755 index 0000000..b898b3c --- /dev/null +++ b/tests/function/call/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +valgrind -q b -q | diff -u test.out - -- cgit v1.1