From 6b7075adc71104c5f6ad652b99fb753565eb67d8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 18 Nov 2016 17:28:46 +0200 Subject: Add function machinery, implement path.normalize() Note that multi-argument functions are not yet "callable" since there is no support for value packs. --- unit-tests/function/call.test | 131 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 unit-tests/function/call.test (limited to 'unit-tests/function/call.test') diff --git a/unit-tests/function/call.test b/unit-tests/function/call.test new file mode 100644 index 0000000..d459300 --- /dev/null +++ b/unit-tests/function/call.test @@ -0,0 +1,131 @@ +# file : unit-tests/function/call.test +# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +: qual-implicit +: +$* <'print $dummy.dummy0()' >'abc' + +: qual-explicit +: +$* <'print $dummy.qual()' >'abc' + +: qual-fail +: +$* <'print $qual()' 2>>EOE != 0 +buildfile:1:8: error: unmatched call to qual\() +EOE + +: variadic +: +# @@ TMP: add some args +$* <'print $variadic([bool] true)' >'1' + +: fail +: +$* <'$fail()' 2>>EOE != 0 +error: failed +buildfile:1:2: info: while calling fail\() +EOE + +: fail-invalid-arg +: +$* <'$fail_arg(abc)' 2>>EOE != 0 +error: invalid argument: invalid uint64 value: 'abc' +buildfile:1:2: info: while calling fail_arg\() +EOE + +: no-match-name +: +$* <'$bogus()' 2>>EOE != 0 +buildfile:1:2: error: unmatched call to bogus\() +EOE + +: no-match-count +: +$* <'$dummy0(abc)' 2>>EOE != 0 +buildfile:1:2: error: unmatched call to dummy0\() + info: candidate: dummy0\(), qualified name dummy.dummy0 +EOE + +: no-match-type +: +$* <'$dummy1([uint64] 123)' 2>>EOE != 0 +buildfile:1:2: error: unmatched call to dummy1\(uint64) + info: candidate: dummy1\(string), qualified name dummy.dummy1 +EOE + +: ambig +: +$* <'$ambig(abc)' 2>>EOE != 0 +buildfile:1:2: error: ambiguous call to ambig\() + info: candidate: ambig\( [, uint64]), qualified name dummy.ambig + info: candidate: ambig\( [, string]), qualified name dummy.ambig +EOE + +: optional-absent +: +$* <'print $optional()' >'true' + +: optional-present +: +$* <'print $optional(abc)' >'false' + +: null-true +: +$* <'print $null([null])' >'true' + +: null-false +: +$* <'print $null(nonull)' >'false' + +: null-fail +: +$* <'$dummy1([string null])' 2>>EOE != 0 +error: invalid argument: null value +buildfile:1:2: info: while calling dummy1\(string) +EOE + +: print-call-1-untyped +: +$* <'$bogus(abc)' 2>>EOE != 0 +buildfile:1:2: error: unmatched call to bogus\() +EOE + +: print-call-1-typed +: +$* <'$bogus([uint64] 123)' 2>>EOE != 0 +buildfile:1:2: error: unmatched call to bogus\(uint64) +EOE + +#\ +@@ TMP +: print-call-2 +: +$* <'$bogus(abc, [uint64] 123)' 2>>EOE != 0 +buildfile:1:2: error: unmatched call to bogus\(, uint64) +EOE +#\ + +: print-fovl +: +$* <'$ambig([bool] true)' 2>>EOE != 0 +buildfile:1:2: error: unmatched call to ambig\(bool) + info: candidate: ambig\( [, uint64]), qualified name dummy.ambig + info: candidate: ambig\( [, string]), qualified name dummy.ambig +EOE + +: print-fovl-variadic +: +$* <'$variadic(abc)' 2>>EOE != 0 +buildfile:1:2: error: unmatched call to variadic\() + info: candidate: variadic\(bool [, ...]) +EOE + +: member-function +: +$* <'print $dummy.length([string] abc)' >'3' + +: data-member +: +$* <'print $dummy.type([name] cxx{foo})' >'cxx' -- cgit v1.1