@@ -16,6 +16,7 @@ const CODE_WITH_MULTIPLE_CODE_BLOCKS_PER_ITEM: &str = include_str!("code/code_15
1616const CODE_WITH_STARKNET_CONTRACT : & str = include_str ! ( "code/code_16.cairo" ) ;
1717const CODE_WITH_COMPILE_FAIL : & str = include_str ! ( "code/code_17.cairo" ) ;
1818const CODE_WITH_SHOULD_PANIC : & str = include_str ! ( "code/code_18.cairo" ) ;
19+ const CODE_WITH_REEXPORTED_ITEM : & str = include_str ! ( "code/code_19.cairo" ) ;
1920const EXPECTED_WITH_EMBEDDINGS_PATH : & str = "tests/data/runnable_examples" ;
2021const EXPECTED_WITH_EMBEDDINGS_MDX_PATH : & str = "tests/data/runnable_examples_mdx" ;
2122const EXPECTED_MULTIPLE_PER_ITEM_PATH : & str = "tests/data/runnable_examples_multiple_per_item" ;
@@ -387,3 +388,35 @@ fn compile_fail() {
387388 error: doc tests failed
388389 "# } ) ;
389390}
391+
392+ #[ test]
393+ fn runnable_examples_not_duplicated_for_reexported_items ( ) {
394+ let t = TempDir :: new ( ) . unwrap ( ) ;
395+ ProjectBuilder :: start ( )
396+ . name ( "hello_world" )
397+ . lib_cairo ( CODE_WITH_REEXPORTED_ITEM )
398+ . build ( & t) ;
399+
400+ Scarb :: quick_command ( )
401+ . arg ( "doc" )
402+ . args ( [ "--output-format" , "markdown" ] )
403+ . arg ( "--disable-remote-linking" )
404+ . current_dir ( & t)
405+ . assert ( )
406+ . success ( )
407+ . stdout_eq ( formatdoc ! { r#"
408+ [..] Running 1 doc examples for `hello_world`
409+ [..] Compiling hello_world_example_1 v0.1.0 ([..])
410+ [..] Finished `dev` profile target(s) in [..]
411+ test hello_world::inner::MyStruct ... ok
412+
413+ test result: ok. 1 passed; 0 failed; 0 ignored
414+ Saving output to: target/doc/hello_world
415+
416+ Run the following to see the results:[..]
417+ `mdbook serve target/doc/hello_world`
418+ (you will need to have mdbook installed)
419+
420+ Or build html docs by running `scarb doc --build`
421+ "# } ) ;
422+ }
0 commit comments