1#!/usr/local/bin/python3.8
2
3# Copyright 2003 Vladimir Prus
4# Distributed under the Boost Software License, Version 1.0.
5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7# This tests the typechecking facilities.
8
9import BoostBuild
10
11t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0)
12
13t.write("file.jam", """
14module .typecheck
15{
16    rule "[path]" ( x )
17    {
18        if ! [ MATCH "^(::)" : $(x) ]
19        {
20            ECHO "Error: $(x) is not a path" ;
21            return true ;
22        }
23    }
24}
25
26rule do ( [path] a )
27{
28}
29
30do $(ARGUMENT) ;
31
32actions dummy { }
33dummy all ;
34""")
35
36t.run_build_system(["-sARGUMENT=::a/b/c"])
37t.run_build_system(["-sARGUMENT=a/b/c"], status=1, stdout="""\
38Error: a/b/c is not a path
39file.jam:18: in module scope
40*** argument error
41* rule do ( [path] a )
42* called with: ( a/b/c )
43* true a
44file.jam:16:see definition of rule 'do' being called
45""")
46
47t.cleanup()
48