aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/function/call.test
blob: 003a828b3a7135d8651e87384f5c3edfc82ffbff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# 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\()
  info: candidate: dummy.qual\()
EOE

: derived-base
: Test derived-to-base overload resolution
:
$* <'print $dummy.abs([dir_path] .)'     >'false';
$* <'print $dummy.abs([abs_dir_path] .)' >'true'

: 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\(<untyped>)
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\(<untyped>)
  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\(<untyped>)
  info: candidate: ambig\(<untyped> [, uint64]), qualified name dummy.ambig
  info: candidate: ambig\(<untyped> [, 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\(<untyped>)
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\(<untyped>, uint64)
EOE
#\

: print-fovl
:
$* <'$ambig([bool] true)' 2>>EOE != 0
buildfile:1:2: error: unmatched call to ambig\(bool)
  info: candidate: ambig\(<untyped> [, uint64]), qualified name dummy.ambig
  info: candidate: ambig\(<untyped> [, string]), qualified name dummy.ambig
EOE

: print-fovl-variadic
:
$* <'$variadic(abc)' 2>>EOE != 0
buildfile:1:2: error: unmatched call to variadic\(<untyped>)
  info: candidate: variadic\(bool [, ...])
EOE

: member-function
:
$* <'print $dummy.length([string] abc)' >'3'

: data-member
:
$* <'print $dummy.type([name] cxx{foo})' >'cxx'