1#!/usr/local/bin/python3.8
2
3# Copyright 2018 Steven Watanabe
4# Distributed under the Boost Software License, Version 1.0.
5# (See accompanying file LICENSE_1_0.txt or copy at
6# http://www.boost.org/LICENSE_1_0.txt)
7
8import BoostBuild
9
10t = BoostBuild.Tester(pass_toolset=0)
11
12t.write("Jamroot.jam", """\
13import param ;
14import assert ;
15import errors : try catch ;
16rule test1 ( )
17{
18    param.handle-named-params ;
19}
20test1 ;
21rule test2 ( sources * )
22{
23    param.handle-named-params sources ;
24    return $(sources) ;
25}
26assert.result : test2 ;
27assert.result test1.cpp test2.cpp : test2 test1.cpp test2.cpp ;
28assert.result test1.cpp test2.cpp : test2 sources test1.cpp test2.cpp ;
29rule test3 ( sources * : requirements * )
30{
31    param.handle-named-params sources requirements ;
32    return $(sources) -- $(requirements) ;
33}
34assert.result -- : test3 ;
35assert.result -- <link>shared : test3 : <link>shared ;
36assert.result test1.cpp -- <link>shared : test3 test1.cpp : <link>shared ;
37assert.result test1.cpp -- <link>shared
38  : test3 test1.cpp : requirements <link>shared ;
39assert.result test1.cpp -- <link>shared
40  : test3 sources test1.cpp : requirements <link>shared ;
41assert.result test1.cpp -- <link>shared
42  : test3 requirements <link>shared : sources test1.cpp ;
43assert.result -- : test3 sources ;
44assert.result -- : test3 requirements ;
45assert.result -- <link>shared : test3 requirements <link>shared ;
46try ;
47{
48    test3 sources test1.cpp : sources test2.cpp ;
49}
50catch Parameter 'sources' passed more than once. ;
51try ;
52{
53    test3 sources test1.cpp : <link>shared ;
54}
55catch "Positional arguments must appear first." ;
56EXIT : 0 ;
57""")
58
59t.run_build_system()
60
61t.cleanup()
62