@@ -285,6 +285,67 @@ theme/index.hbs
285285 ) ;
286286}
287287
288+ /// Runs `mdbook init --theme` in a directory which already contains a theme directory
289+ #[ test]
290+ fn existing_theme ( ) {
291+ BookTest :: from_dir ( "init/init_with_existing_theme" )
292+ . run ( "init --theme" , |cmd| {
293+ cmd. expect_stdout ( str![ [ r#"
294+
295+ Copying the default theme to [ROOT]/theme
296+ This could potentially overwrite files already present in that directory.
297+
298+ Are you sure you want to continue? (y/n)
299+ All done, no errors...
300+
301+ "# ] ] )
302+ . expect_stderr ( str![ [ r#"
303+ [TIMESTAMP] [INFO] (mdbook::book::init): Creating a new book with stub content
304+
305+ "# ] ] )
306+ . stdin ( "y\n " )
307+ . args ( & [ "--ignore" , "none" , "--title" , "My Book Title" ] ) ;
308+ } )
309+ . check_file_list (
310+ "." ,
311+ str![ [ r#"
312+ book
313+ book.toml
314+ src
315+ src/SUMMARY.md
316+ src/chapter_1.md
317+ theme
318+ theme/book.js
319+ theme/css
320+ theme/css/chrome.css
321+ theme/css/general.css
322+ theme/css/print.css
323+ theme/css/variables.css
324+ theme/favicon.png
325+ theme/favicon.svg
326+ theme/fonts
327+ theme/fonts/OPEN-SANS-LICENSE.txt
328+ theme/fonts/SOURCE-CODE-PRO-LICENSE.txt
329+ theme/fonts/fonts.css
330+ theme/fonts/open-sans-v17-all-charsets-300.woff2
331+ theme/fonts/open-sans-v17-all-charsets-300italic.woff2
332+ theme/fonts/open-sans-v17-all-charsets-600.woff2
333+ theme/fonts/open-sans-v17-all-charsets-600italic.woff2
334+ theme/fonts/open-sans-v17-all-charsets-700.woff2
335+ theme/fonts/open-sans-v17-all-charsets-700italic.woff2
336+ theme/fonts/open-sans-v17-all-charsets-800.woff2
337+ theme/fonts/open-sans-v17-all-charsets-800italic.woff2
338+ theme/fonts/open-sans-v17-all-charsets-italic.woff2
339+ theme/fonts/open-sans-v17-all-charsets-regular.woff2
340+ theme/fonts/source-code-pro-v11-all-charsets-500.woff2
341+ theme/highlight.css
342+ theme/highlight.js
343+ theme/index.hbs
344+ theme/placeholder_theme_file.md
345+ "# ] ] ,
346+ ) ;
347+ }
348+
288349/// Run `mdbook init` with `--ignore git` to create a `.gitignore` file
289350#[ test]
290351fn init_with_ignore_git_creates_gitignore ( ) {
0 commit comments