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

.include common.test

status += -d prj

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

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

  $build prj/ 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/ 2>>/~%EOE%
    %.{4}
    %ld libprj/.+%{3}
    EOE
}

: cfg
{
  : dir-and-name
  :
  {
    $* -C prj-config @cfg prj $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 project source
  : directory path and configuration name. Here we also use the dash-prefixed
  : name (as in Windows PowerShell where the leading '@' character is special).
  :
  {
    $* -C -@cfg prj $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
  }
}