File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,39 @@ src = "src"
101101 assert ! ( !test. dir. join( ".gitignore" ) . exists( ) ) ;
102102}
103103
104+ // Run `mdbook init` and provide responses to the prompts to create a `.gitignore` file and set a book title.
105+ #[ test]
106+ fn init_with_prompts ( ) {
107+ let mut test = BookTest :: empty ( ) ;
108+ test. run ( "init" , |cmd| {
109+ cmd. stdin ( "y\n My Book Title\n " )
110+ . expect_stdout ( str![ [ r#"
111+
112+ Do you want a .gitignore to be created? (y/n)
113+ What title would you like to give the book?
114+
115+ All done, no errors...
116+
117+ "# ] ] )
118+ . expect_stderr ( str![ [ r#"
119+ [TIMESTAMP] [INFO] (mdbook::book::init): Creating a new book with stub content
120+
121+ "# ] ] ) ;
122+ } )
123+ . check_file (
124+ "book.toml" ,
125+ str![ [ r#"
126+ [book]
127+ authors = []
128+ language = "en"
129+ src = "src"
130+ title = "My Book Title"
131+
132+ "# ] ] ,
133+ ) ;
134+ assert ! ( test. dir. join( ".gitignore" ) . exists( ) ) ;
135+ }
136+
104137// Run `mdbook init` with `--title` without git config.
105138//
106139// Regression test for https://github.com/rust-lang/mdBook/issues/2485
You can’t perform that action at this time.
0 commit comments