1#!/usr/local/bin/python3.8
2
3# Copyright 2012 Steven Watanabe
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 EXIT rule.
8
9import BoostBuild
10
11def test_exit(name):
12    t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0)
13
14    t.write("file.jam", "%s ;" % name)
15    t.run_build_system(status=1, stdout="\n")
16    t.rm(".")
17
18    t.write("file.jam", "%s : 0 ;" % name)
19    t.run_build_system(stdout="\n")
20    t.rm(".")
21
22    t.write("file.jam", "%s : 1 ;" % name)
23    t.run_build_system(status=1, stdout="\n")
24    t.rm(".")
25
26    t.write("file.jam", "%s : 2 ;" % name)
27    t.run_build_system(status=2, stdout="\n")
28    t.rm(".")
29
30    t.write("file.jam", "%s a message ;" % name)
31    t.run_build_system(status=1, stdout="a message\n")
32    t.rm(".")
33
34    t.write("file.jam", "%s a message : 0 ;" % name)
35    t.run_build_system(stdout="a message\n")
36    t.rm(".")
37
38    t.cleanup()
39
40test_exit("EXIT")
41test_exit("Exit")
42test_exit("exit")
43