aboutsummaryrefslogtreecommitdiff
path: root/tests/new.test
blob: ab9e25ad31cbcc7b372b8b4756442c3073176a2d (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
# file      : tests/new.test
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

.include common.test

cxx = "config.cxx=$config.cxx"

status += -d prj

: exe
{
  $* -t exe -l c++ prj 2>>/"EOE" &prj/***;
    created new executable project prj in $~/prj/
    EOE

  $build prj/ $cxx 2>>/EOE
    c++ prj/prj/cxx{prj}
    ld prj/prj/exe{prj}
    EOE
}

: lib
{
  $* -t lib -l c++ libprj 2>>/"EOE" &libprj/***;
    created new library project libprj in $~/libprj/
    EOE

  $build libprj/ $cxx 2>>/~%EOE%
    %.{4}
    %ld libprj/.+%{3}
    EOE
}

: pkg
:
: Test creating a library as a separate package in the project.
:
{
  $* -t empty prj 2>>/"EOE" &prj/***;
    created new empty project prj in $~/prj/
    EOE

  $* --package -t lib libprj -d prj 2>>/"EOE";
    created new library package libprj in $~/prj/libprj/
    EOE

  $build prj/libprj/ $cxx 2>>/~%EOE%
    %.{4}
    %ld prj/libprj/.+%{3}
    EOE
}

: cfg
{
  : dir-and-name
  :
  {
    $* -C prj-config @cfg prj cc $cxx 2>>/~"%EOE%" &prj/*** &prj-config/***;
      created new executable project prj in $~/prj/
      created configuration @cfg $~/prj-config/ \(1, default, forwarded, auto-synchronized\)
      synchronizing:
      %  new prj.+19700101000000%
      EOE

    $status >'prj configured 0.1.0-a.0.19700101000000';

    $build prj/ 2>>/EOE
      mkdir prj-config/prj/fsdir{prj/}
      c++ prj/prj/cxx{prj}@prj-config/prj/prj/
      ld prj-config/prj/prj/exe{prj}
      ln prj-config/prj/prj/exe{prj} -> prj/prj/
      EOE
  }

  : name
  :
  : Test deducing the configuration directory path from the project source
  : directory path and the configuration name. Here we also use the
  : dash-prefixed name (as in Windows PowerShell where the leading '@'
  : character is special).
  :
  {
    $* -C -@cfg prj cc $cxx 2>>/~"%EOE%" &prj/*** &prj-cfg/***;
      created new executable project prj in $~/prj/
      created configuration @cfg $~/prj-cfg/ \(1, default, forwarded, auto-synchronized\)
      synchronizing:
      %  new prj.+19700101000000%
      EOE

    $status >'prj configured 0.1.0-a.0.19700101000000';

    $build prj/ 2>>/EOE
      mkdir prj-cfg/prj/fsdir{prj/}
      c++ prj/prj/cxx{prj}@prj-cfg/prj/prj/
      ld prj-cfg/prj/prj/exe{prj}
      ln prj-cfg/prj/prj/exe{prj} -> prj/prj/
      EOE
  }
}