aboutsummaryrefslogtreecommitdiff
path: root/tests/in/testscript
blob: 3b1442a6eeeeaac9a92eaed8cc14e6639536be19 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# file      : tests/in/testscript
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

crosstest = false
test.arguments =

.include ../common.test

+cat <<EOI >=build/root.build
using in
EOI

: basic
:
cat <<EOI >=test.in;
  foo = $foo$
  EOI
cat <<EOI >=buildfile;
  file{test}: in{test}
  file{test}: foo = FOO
  EOI
$* <<<buildfile;
cat test >>EOO;
  foo = FOO
  EOO
$* clean <<<buildfile

: lax
:
cat <<EOI >=test.in;
  $10
  $foo bar$ baz
  EOI
$* <<EOI &test &test.d;
  file{test}: in{test}
  file{test}: in.substitution = lax
  EOI
cat test >>EOO
  $10
  $foo bar$ baz
  EOO

: rebuild
:
cat <'$foo$ $bar$' >=test.in;
$* <<EOI &test &test.d;
  foo = foo
  bar = bar
  file{test}: in{test}
  EOI
cat test >'foo bar';
$* <<EOI;
  foo = FOO
  bar = bar
  file{test}: in{test}
  EOI
cat test >'FOO bar';
$* <<EOI;
  foo = FOO
  bar = BAR
  file{test}: in{test}
  EOI
cat test >'FOO BAR';
cat <'$fox$ $baz$' >=test.in;
$* <<EOI;
  fox = fox
  baz = baz
  file{test}: in{test}
  EOI
cat test >'fox baz';
mv test.in tst.in;
$* <<EOI;
  fox = FOX
  baz = BAZ
  file{test}: in{tst.in}
  EOI
cat test >'FOX BAZ'

: rebuild-diag
:
cat <<EOI >=test.in;
  foo = $foo$
  bar = $bar$
  EOI
$* <<EOI &test &test.d;
  foo = foo
  bar = bar
  file{test}: in{test}
  EOI
$* <<EOI 2>>EOE != 0
  foo = foo
  file{test}: in{test}
  EOI
  test.in:2: error: undefined variable 'bar'
  EOE

: executable
:
: Test creation of executables (permissions, extensions).
:
if ($test.target == $build.host && $build.host.class != 'windows')
{
  cat <<EOI >=hello.in;
    #!/bin/sh
    echo 'Hello, $name$!'
    EOI
  $* <<EOI &hello &hello.d;
    exe{hello}: in{hello}
    exe{hello}: name = 'World'
    EOI
  $~/hello >'Hello, World!'
}