-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathrerun_itself.feature
141 lines (129 loc) · 3.94 KB
/
rerun_itself.feature
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Feature: Re-run reggae when dependencies deem it necessary
As a user of reggae
I want it to keep track of when it needs to regenerate the build
So I don't have to
Background:
Given a file named "proj/src/main.d" with:
"""
import func;
void main() { myfunc(); }
"""
And a file named "proj/src/func.d" with:
"""
module func;
import std.stdio;
void myfunc() { writeln(`Mainymainy`); }
"""
And a file named "proj/src/other.d" with:
"""
module func;
import std.stdio;
void myfunc() { writeln(`Lookee me!`); }
"""
And a file named "proj/reggaefile.d" with:
"""
import reggae;
import reggaebuild.defs; //for funcObj
enum mainObj = Target(`main.o`,
`dmd -I$project/src -c $in -of$out`,
Target(`src/main.d`));
enum app = Target(`myapp`,
`dmd -of$out $in`,
[mainObj, funcObj],
);
mixin build!(app);
"""
And a file named "proj/reggaebuild/defs.d" with:
"""
module reggaebuild.defs;
import reggae;
enum funcObj = Target(`func.o`,
`dmd -I$project/src -c $in -of$out`,
Target(`src/func.d`));
"""
@ninja
Scenario: D Rerun with Ninja
Given I successfully run `reggae -b ninja proj`
And I successfully run `ninja`
When I successfully run `./myapp`
Then the output should contain:
"""
Mainymainy
"""
And the output should not contain:
"""
Lookee me!
"""
Given I successfully run `sleep 1` for up to 2 seconds
And I overwrite "proj/reggaebuild/defs.d" with:
"""
module reggaebuild.defs;
import reggae;
enum funcObj = Target(`other.o`,
`dmd -I$project/src -c $in -of$out`,
Target(`src/other.d`));
"""
When I successfully run `ninja`
And I successfully run `./myapp`
Then the output should contain:
"""
Lookee me!
"""
Given I successfully run `ninja -t clean`
Then I successfully run `ninja`
@make
Scenario: D Rerun with Make
Given I successfully run `reggae -b make proj`
And I successfully run `make`
When I successfully run `./myapp`
Then the output should contain:
"""
Mainymainy
"""
And the output should not contain:
"""
Lookee me!
"""
Given I successfully run `sleep 1` for up to 2 seconds
And I overwrite "proj/reggaebuild/defs.d" with:
"""
module reggaebuild.defs;
import reggae;
enum funcObj = Target(`other.o`,
`dmd -I$project/src -c $in -of$out`,
Target(`src/other.d`));
"""
When I successfully run `make`
And I successfully run `./myapp`
Then the output should contain:
"""
Lookee me!
"""
@binary
Scenario: D Rerun with Binary
Given I successfully run `reggae -b binary proj`
And I successfully run `./build`
When I successfully run `./myapp`
Then the output should contain:
"""
Mainymainy
"""
And the output should not contain:
"""
Lookee me!
"""
Given I successfully run `sleep 1` for up to 2 seconds
And I overwrite "proj/reggaebuild/defs.d" with:
"""
module reggaebuild.defs;
import reggae;
enum funcObj = Target(`other.o`,
`dmd -I$project/src -c $in -of$out`,
Target(`src/other.d`));
"""
When I successfully run `./build`
And I successfully run `./myapp`
Then the output should contain:
"""
Lookee me!
"""