@@ -8,17 +8,17 @@ mod templating;
88mod validation;
99mod write;
1010
11- use module:: { Input , Module , ModuleType } ;
11+ pub use module:: { Input , Module , ModuleType } ;
1212
1313/// This struct stores options based on the command-line arguments,
1414/// and is passed to various functions across the program.
1515#[ derive( Debug , Clone ) ]
1616pub struct Options {
17- comments : bool ,
18- prefixes : bool ,
19- examples : bool ,
20- target_dir : String ,
21- verbosity : Verbosity ,
17+ pub comments : bool ,
18+ pub prefixes : bool ,
19+ pub examples : bool ,
20+ pub target_dir : String ,
21+ pub verbosity : Verbosity ,
2222}
2323
2424impl Options {
@@ -137,166 +137,3 @@ fn process_module_type(
137137
138138 modules_from_type. collect ( )
139139}
140-
141- // These tests act as pseudo-integration tests. They let the top-level functions generate
142- // each module type and then they compare the generated content with a pre-generated specimen
143- // to check that we introduce no changes unknowingly.
144- #[ cfg( test) ]
145- mod tests {
146- use super :: * ;
147-
148- // These values represent the default newdoc options.
149- fn basic_options ( ) -> Options {
150- Options {
151- comments : true ,
152- prefixes : true ,
153- examples : true ,
154- target_dir : "." . to_string ( ) ,
155- verbosity : Verbosity :: Default ,
156- }
157- }
158-
159- /// Test that we generate the assembly that we expect.
160- #[ test]
161- fn test_assembly ( ) {
162- let mod_type = ModuleType :: Assembly ;
163- let mod_title = "Testing that an assembly forms properly" ;
164- let options = basic_options ( ) ;
165- let assembly = Module :: new ( mod_type, mod_title, & options) ;
166-
167- let pre_generated =
168- include_str ! ( "../data/generated/assembly_testing-that-an-assembly-forms-properly.adoc" ) ;
169-
170- assert_eq ! ( assembly. text, pre_generated) ;
171- }
172-
173- /// Test that we generate the concept module that we expect.
174- #[ test]
175- fn test_concept_module ( ) {
176- let mod_type = ModuleType :: Concept ;
177- let mod_title = "A title that tests a concept" ;
178- let options = basic_options ( ) ;
179- let concept = Module :: new ( mod_type, mod_title, & options) ;
180-
181- let pre_generated = include_str ! ( "../data/generated/con_a-title-that-tests-a-concept.adoc" ) ;
182-
183- assert_eq ! ( concept. text, pre_generated) ;
184- }
185-
186- /// Test that we generate the procedure module that we expect.
187- #[ test]
188- fn test_procedure_module ( ) {
189- let mod_type = ModuleType :: Procedure ;
190- let mod_title = "Testing a procedure" ;
191- let options = basic_options ( ) ;
192- let procedure = Module :: new ( mod_type, mod_title, & options) ;
193-
194- let pre_generated = include_str ! ( "../data/generated/proc_testing-a-procedure.adoc" ) ;
195-
196- assert_eq ! ( procedure. text, pre_generated) ;
197- }
198-
199- /// Test that we generate the reference module that we expect.
200- #[ test]
201- fn test_reference_module ( ) {
202- let mod_type = ModuleType :: Reference ;
203- let mod_title = "The lines in a reference module" ;
204- let options = basic_options ( ) ;
205- let reference = Module :: new ( mod_type, mod_title, & options) ;
206-
207- let pre_generated =
208- include_str ! ( "../data/generated/ref_the-lines-in-a-reference-module.adoc" ) ;
209-
210- assert_eq ! ( reference. text, pre_generated) ;
211- }
212-
213- /// Test that we generate the snippet file that we expect.
214- #[ test]
215- fn test_snippet_file ( ) {
216- let mod_type = ModuleType :: Snippet ;
217- let mod_title = "Some notes in a snippet file" ;
218- let options = basic_options ( ) ;
219- let snippet = Module :: new ( mod_type, mod_title, & options) ;
220-
221- let pre_generated =
222- include_str ! ( "../data/generated/snip_some-notes-in-a-snippet-file.adoc" ) ;
223-
224- assert_eq ! ( snippet. text, pre_generated) ;
225- }
226-
227- // These values strip down the modules to the bare minimum.
228- fn minimal_options ( ) -> Options {
229- Options {
230- comments : false ,
231- prefixes : false ,
232- examples : false ,
233- target_dir : "." . to_string ( ) ,
234- verbosity : Verbosity :: Default ,
235- }
236- }
237-
238- /// Test that we generate the assembly that we expect.
239- #[ test]
240- fn test_minimal_assembly ( ) {
241- let mod_type = ModuleType :: Assembly ;
242- let mod_title = "Minimal assembly" ;
243- let options = minimal_options ( ) ;
244- let assembly = Module :: new ( mod_type, mod_title, & options) ;
245-
246- let pre_generated = include_str ! ( "../data/generated/minimal-assembly.adoc" ) ;
247-
248- assert_eq ! ( assembly. text, pre_generated) ;
249- }
250-
251- /// Test that we generate the concept module that we expect.
252- #[ test]
253- fn test_minimal_concept ( ) {
254- let mod_type = ModuleType :: Concept ;
255- let mod_title = "Minimal concept" ;
256- let options = minimal_options ( ) ;
257- let concept = Module :: new ( mod_type, mod_title, & options) ;
258-
259- let pre_generated = include_str ! ( "../data/generated/minimal-concept.adoc" ) ;
260-
261- assert_eq ! ( concept. text, pre_generated) ;
262- }
263-
264- /// Test that we generate the procedure module that we expect.
265- #[ test]
266- fn test_minimal_procedure ( ) {
267- let mod_type = ModuleType :: Procedure ;
268- let mod_title = "Minimal procedure" ;
269- let options = minimal_options ( ) ;
270- let procedure = Module :: new ( mod_type, mod_title, & options) ;
271-
272- let pre_generated = include_str ! ( "../data/generated/minimal-procedure.adoc" ) ;
273-
274- assert_eq ! ( procedure. text, pre_generated) ;
275- }
276-
277- /// Test that we generate the reference module that we expect.
278- #[ test]
279- fn test_minimal_reference ( ) {
280- let mod_type = ModuleType :: Reference ;
281- let mod_title = "Minimal reference" ;
282- let options = minimal_options ( ) ;
283- let reference = Module :: new ( mod_type, mod_title, & options) ;
284-
285- let pre_generated = include_str ! ( "../data/generated/minimal-reference.adoc" ) ;
286-
287- assert_eq ! ( reference. text, pre_generated) ;
288- }
289-
290- /// Test that we generate the snippet file that we expect.
291- #[ test]
292- fn test_minimal_snippet ( ) {
293- let mod_type = ModuleType :: Snippet ;
294- let mod_title = "Minimal snippet" ;
295- let options = minimal_options ( ) ;
296- let snippet = Module :: new ( mod_type, mod_title, & options) ;
297-
298- let pre_generated = include_str ! ( "../data/generated/minimal-snippet.adoc" ) ;
299-
300- assert_eq ! ( snippet. text, pre_generated) ;
301- }
302- }
0 commit comments