File tree 5 files changed +21
-8
lines changed
5 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -242,13 +242,12 @@ impl MDBook {
242
242
if let BookItem :: Chapter ( ref ch) = * item {
243
243
if !ch. path . as_os_str ( ) . is_empty ( ) {
244
244
let path = self . source_dir ( ) . join ( & ch. path ) ;
245
- let content = utils:: fs:: file_to_string ( & path) ?;
246
245
info ! ( "Testing file: {:?}" , path) ;
247
246
248
247
// write preprocessed file to tempdir
249
248
let path = temp_dir. path ( ) . join ( & ch. path ) ;
250
249
let mut tmpf = utils:: fs:: create_file ( & path) ?;
251
- tmpf. write_all ( content. as_bytes ( ) ) ?;
250
+ tmpf. write_all ( ch . content . as_bytes ( ) ) ?;
252
251
253
252
let output = Command :: new ( "rustdoc" )
254
253
. arg ( & path)
Original file line number Diff line number Diff line change @@ -58,8 +58,11 @@ impl DummyBook {
58
58
} ) ?;
59
59
60
60
let sub_pattern = if self . passing_test { "true" } else { "false" } ;
61
- let file_containing_test = temp. path ( ) . join ( "src/first/nested.md" ) ;
62
- replace_pattern_in_file ( & file_containing_test, "$TEST_STATUS" , sub_pattern) ?;
61
+ let files_containing_tests = [ "src/first/nested.md" , "src/first/nested-test.rs" ] ;
62
+ for file in & files_containing_tests {
63
+ let path_containing_tests = temp. path ( ) . join ( file) ;
64
+ replace_pattern_in_file ( & path_containing_tests, "$TEST_STATUS" , sub_pattern) ?;
65
+ }
63
66
64
67
Ok ( temp)
65
68
}
Original file line number Diff line number Diff line change
1
+ assert ! ( $TEST_STATUS ) ;
Original file line number Diff line number Diff line change @@ -7,3 +7,7 @@ assert!($TEST_STATUS);
7
7
```
8
8
9
9
## Some Section
10
+
11
+ ``` rust
12
+ {{#include nested - test . rs}}
13
+ ```
Original file line number Diff line number Diff line change 46
46
"title" : 2
47
47
},
48
48
"5" : {
49
- "body" : 0 ,
49
+ "body" : 1 ,
50
50
"breadcrumbs" : 3 ,
51
51
"title" : 1
52
52
},
109
109
"title" : " Nested Chapter"
110
110
},
111
111
"5" : {
112
- "body" : " " ,
112
+ "body" : " assert!(true); " ,
113
113
"breadcrumbs" : " First Chapter » Some Section" ,
114
114
"id" : " 5" ,
115
115
"title" : " Some Section"
177
177
"df" : 0 ,
178
178
"docs" : {},
179
179
"u" : {
180
- "df" : 1 ,
180
+ "df" : 2 ,
181
181
"docs" : {
182
182
"4" : {
183
183
"tf" : 1.0
184
+ },
185
+ "5" : {
186
+ "tf" : 1.0
184
187
}
185
188
}
186
189
}
1336
1339
"df" : 0 ,
1337
1340
"docs" : {},
1338
1341
"u" : {
1339
- "df" : 1 ,
1342
+ "df" : 2 ,
1340
1343
"docs" : {
1341
1344
"4" : {
1342
1345
"tf" : 1.0
1346
+ },
1347
+ "5" : {
1348
+ "tf" : 1.0
1343
1349
}
1344
1350
}
1345
1351
}
You can’t perform that action at this time.
0 commit comments