@@ -224,18 +224,16 @@ export function fooFn(a: number) {
224224 ] ,
225225 )
226226 . await ;
227- let document = DocParser :: new (
227+ let output = DocParser :: new (
228228 & graph,
229229 & analyzer,
230230 & [ specifier] ,
231231 DocParserOptions :: default ( ) ,
232232 )
233233 . unwrap ( )
234234 . parse ( )
235- . unwrap ( )
236- . into_values ( )
237- . next ( )
238235 . unwrap ( ) ;
236+ let document = output. values ( ) . next ( ) . unwrap ( ) ;
239237
240238 let expected_symbols = json ! ( [
241239 {
@@ -338,7 +336,7 @@ export function fooFn(a: number) {
338336 assert_eq ! ( actual, expected_imports) ;
339337
340338 assert ! (
341- DocPrinter :: new( & document , false , false )
339+ DocPrinter :: new( & output , false , false )
342340 . to_string( )
343341 . as_str( )
344342 . contains( "function fooFn(a: number)" )
@@ -363,19 +361,16 @@ export { Hello } from "./reexport.ts";
363361 ] ,
364362 )
365363 . await ;
366- let entries = DocParser :: new (
364+ let output = DocParser :: new (
367365 & graph,
368366 & analyzer,
369367 & [ specifier] ,
370368 DocParserOptions :: default ( ) ,
371369 )
372370 . unwrap ( )
373371 . parse ( )
374- . unwrap ( )
375- . into_values ( )
376- . next ( )
377- . unwrap ( )
378- . symbols ;
372+ . unwrap ( ) ;
373+ let entries = & output. values ( ) . next ( ) . unwrap ( ) . symbols ;
379374
380375 let expected_json = json ! ( [
381376 {
@@ -406,17 +401,12 @@ export { Hello } from "./reexport.ts";
406401 ]
407402 }
408403 ] ) ;
409- let actual = serde_json:: to_value ( & entries) . unwrap ( ) ;
404+ let actual = serde_json:: to_value ( entries) . unwrap ( ) ;
410405 assert_eq ! ( actual, expected_json) ;
411406
412- let doc = crate :: node:: Document {
413- module_doc : Default :: default ( ) ,
414- imports : vec ! [ ] ,
415- symbols : entries,
416- } ;
417- let output = DocPrinter :: new ( & doc, false , false ) . to_string ( ) ;
418- assert ! ( output. contains( "class Hello" ) ) ;
419- assert ! ( output. contains( "interface Hello" ) ) ;
407+ let text = DocPrinter :: new ( & output, false , false ) . to_string ( ) ;
408+ assert ! ( text. contains( "class Hello" ) ) ;
409+ assert ! ( text. contains( "interface Hello" ) ) ;
420410}
421411
422412#[ tokio:: test]
@@ -434,19 +424,16 @@ async fn deep_reexports() {
434424 ] ,
435425 )
436426 . await ;
437- let entries = DocParser :: new (
427+ let output = DocParser :: new (
438428 & graph,
439429 & analyzer,
440430 & [ specifier] ,
441431 DocParserOptions :: default ( ) ,
442432 )
443433 . unwrap ( )
444434 . parse ( )
445- . unwrap ( )
446- . into_values ( )
447- . next ( )
448- . unwrap ( )
449- . symbols ;
435+ . unwrap ( ) ;
436+ let entries = & output. values ( ) . next ( ) . unwrap ( ) . symbols ;
450437
451438 let expected_json = json ! ( [
452439 {
@@ -471,16 +458,11 @@ async fn deep_reexports() {
471458 } ]
472459 }
473460 ] ) ;
474- let actual = serde_json:: to_value ( & entries) . unwrap ( ) ;
461+ let actual = serde_json:: to_value ( entries) . unwrap ( ) ;
475462 assert_eq ! ( actual, expected_json) ;
476463
477- let doc = crate :: node:: Document {
478- module_doc : Default :: default ( ) ,
479- imports : vec ! [ ] ,
480- symbols : entries,
481- } ;
482464 assert ! (
483- DocPrinter :: new( & doc , false , false )
465+ DocPrinter :: new( & output , false , false )
484466 . to_string( )
485467 . contains( "const foo" )
486468 ) ;
0 commit comments