aboutsummaryrefslogtreecommitdiff
path: root/tests/cc/modules/headers.testscript
blob: 4fb9a426721788b2383ab6855f8ca296bd616e2d (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
# file      : tests/cc/modules/headers.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

# Test header units.
#

.include common.testscript

+$headers || exit

# Common source files that are symlinked in the test directories if used.
#
+cat <<EOI >=core.hxx
  #ifdef CORE_IN
  #  error macro isolation
  #endif
  #define CORE_OUT 1
  inline int f () {return 1;}
  EOI

: import
:
#ln -s ../core.hxx ./; @@ why isn't working?
cp ../core.hxx ./;
cat <<EOI >=driver.cxx;
  #define CORE_IN 1
  import "core.hxx";
  #ifndef CORE_OUT
  #  error macro export
  #endif
  int main () {return f () - CORE_OUT;}
  EOI
$* test clean <<EOI
  exe{test}: cxx{driver}
  EOI

: include-translation
:
#ln -s ../core.hxx ./; @@ why isn't working?
cp ../core.hxx ./;
cat <<EOI >=driver.cxx;
  #define CORE_IN 1
  #include "core.hxx"
  #ifndef CORE_OUT
  #  error macro export
  #endif
  int main () {return f () - CORE_OUT;}
  EOI
$* test clean config.cxx.importable_headers="$~/core.hxx" <<EOI
  exe{test}: cxx{driver}
  EOI

# Clean module sidebuilds.
#
-$* clean <<EOI
./:
EOI