3 # Copyright 2001 Dave Abrahams
4 # Copyright 2011 Steven Watanabe
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
11 t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
13 t.write("echo_args.jam", """
14 rule echo_args ( a b ? c ? : d + : e * )
16 ECHO a= $(a) b= $(b) c= $(c) ":" d= $(d) ":" e= $(e) ;
19 rule echo_varargs ( a b ? c ? : d + : e * : * )
21 ECHO a= $(a) b= $(b) c= $(c) ":" d= $(d) ":" e= $(e)
22 ": rest= "$(4[1]) $(4[2])
31 t.write("file.jam", "include echo_args.jam ; echo_args ;")
32 t.run_build_system("-ffile.jam", status=1)
33 t.expect_output_line("* missing argument a");
35 t.write("file.jam", "include echo_args.jam ; echo_args 1 2 : 3 : 4 : 5 ;")
36 t.run_build_system("-ffile.jam", status=1)
37 t.expect_output_line("* extra argument 5");
39 t.write("file.jam", "include echo_args.jam ; echo_args a b c1 c2 : d ;")
40 t.run_build_system("-ffile.jam", status=1)
41 t.expect_output_line("* extra argument c2");
45 t.write("file.jam", "include echo_args.jam ; echo_args 1 2 3 : 4 ;")
46 t.run_build_system("-ffile.jam", status=1)
47 t.expect_output_line("a= 1 b= 2 c= 3 : d= 4 : e=");
49 t.write("file.jam", "include echo_args.jam ; echo_args 1 2 : 3 ;")
50 t.run_build_system("-ffile.jam", status=1)
51 t.expect_output_line("a= 1 b= 2 c= : d= 3 : e=");
53 t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 ;")
54 t.run_build_system("-ffile.jam", status=1)
55 t.expect_output_line("a= 1 b= c= : d= 2 : e=");
59 t.write("file.jam", "include echo_args.jam ; echo_args 1 ;")
60 t.run_build_system("-ffile.jam", status=1)
61 t.expect_output_line("* missing argument d");
63 t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 3 ;")
64 t.run_build_system("-ffile.jam", status=1)
65 t.expect_output_line("a= 1 b= c= : d= 2 3 : e=");
67 t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 3 4 ;")
68 t.run_build_system("-ffile.jam", status=1)
69 t.expect_output_line("a= 1 b= c= : d= 2 3 4 : e=");
73 t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 : 3 ;")
74 t.run_build_system("-ffile.jam", status=1)
75 t.expect_output_line("a= 1 b= c= : d= 2 : e= 3");
77 t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 : 3 4 ;")
78 t.run_build_system("-ffile.jam", status=1)
79 t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4");
81 t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 : 3 4 5 ;")
82 t.run_build_system("-ffile.jam", status=1)
83 t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5");
89 t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 ;")
90 t.run_build_system("-ffile.jam", status=1)
91 t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5");
93 t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 : 6 ;")
94 t.run_build_system("-ffile.jam", status=1)
95 t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6");
97 t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 : 6 7 ;")
98 t.run_build_system("-ffile.jam", status=1)
99 t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7");
101 t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 : 6 7 : 8 ;")
102 t.run_build_system("-ffile.jam", status=1)
103 t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7 : 8");
105 t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 : 6 7 : 8 : 9 ;")
106 t.run_build_system("-ffile.jam", status=1)
107 t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7 : 8 : 9");