about summary refs log tree commit diff stats
path: root/static-dispatch.mu
blob: a0157d133c705f6c1dbb30375d1939ee2a6cd2d1 (plain) (blame)
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
# Example program showing how multiple functions with the same name can
# coexist, and how we select between them.
#
# Expected output:
#   4
#   7
#   7

def test a:num -> b:num [
  local-scope
  load-inputs
  b <- add a, 1
]

def test a:num, b:num -> c:num [
  local-scope
  load-inputs
  c <- add a, b
]

def main [
  local-scope
  a:num <- test 3  # selects single-input version
  $print a, 10/newline
  b:num <- test 3, 4  # selects double-input version
  $print b, 10/newline
  c:num <- test 3, 4, 5  # prefers double- to single-input version
  $print c, 10/newline
]
(void **state); void parse_cmd_freetext_with_many_quoted_and_many_spaces(void **state); void parse_cmd_with_quoted_freetext(void **state); void parse_cmd_with_third_arg_quoted_0_min_3_max(void **state); void parse_cmd_with_second_arg_quoted_0_min_3_max(void **state); void parse_cmd_with_second_and_third_arg_quoted_0_min_3_max(void **state); void count_one_token(void **state); void count_one_token_quoted_no_whitespace(void **state); void count_one_token_quoted_with_whitespace(void **state); void count_two_tokens(void **state); void count_two_tokens_first_quoted(void **state); void count_two_tokens_second_quoted(void **state); void count_two_tokens_both_quoted(void **state); void get_first_of_one(void **state); void get_first_of_two(void **state); void get_first_two_of_three(void **state); void get_first_two_of_three_first_quoted(void **state); void get_first_two_of_three_second_quoted(void **state); void get_first_two_of_three_first_and_second_quoted(void **state); void parse_options_when_none_returns_empty_hasmap(void **state); void parse_options_when_opt1_no_val_sets_error(void **state); void parse_options_when_one_returns_map(void **state); void parse_options_when_opt2_no_val_sets_error(void **state); void parse_options_when_two_returns_map(void **state); void parse_options_when_opt3_no_val_sets_error(void **state); void parse_options_when_three_returns_map(void **state); void parse_options_when_unknown_opt_sets_error(void **state); void parse_options_with_duplicated_option_sets_error(void **state);