From 27d35b436948f7fdbaf7a7dce23ee5363414739b Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 27 Aug 2024 14:48:43 +0200 Subject: [PATCH] tests(generate): fix existing tests --- tests/test_binary_generate.nim | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/test_binary_generate.nim b/tests/test_binary_generate.nim index 3daf1fa0..892c39df 100644 --- a/tests/test_binary_generate.nim +++ b/tests/test_binary_generate.nim @@ -23,13 +23,18 @@ proc main = suite "generate": const trackDir = testsDir / ".test_elixir_track_repo" let generateCmd = &"{binaryPath} -t {trackDir} generate" + let generateCmdUpdate = &"{generateCmd} --update" + let generateCmdUpdateYes = &"{generateCmdUpdate} --yes" # Setup: clone a track repo, and checkout a known state setupExercismRepo("elixir", trackDir, "91ccf91940f32aff3726c772695b2de167d8192a") # 2022-06-12 test "`configlet generate` exits with 0 when there are no `.md.tpl` files": - execAndCheck(0, generateCmd, "") + const expectedOutput = fmt""" + Every introduction file is up-to-date! + """.unindent() + execAndCheck(0, generateCmdUpdateYes, expectedOutput) test "and does not make a change": checkNoDiff(trackDir) @@ -39,7 +44,7 @@ proc main = removeIntro = false) test "`configlet generate` exits with 1 for an invalid placeholder usage": - execAndCheckExitCode(1, generateCmd) + execAndCheckExitCode(1, generateCmdUpdateYes) test "and does not make a change": checkNoDiff(trackDir) @@ -49,7 +54,11 @@ proc main = removeIntro = true) test "`configlet generate` exits with 0 for a valid `.md.tpl` file": - execAndCheck(0, generateCmd, "") + const expectedOutput = fmt""" + Outdated: exercises/concept/bird-count/.docs/introduction.md + Generated 1 file + """.unindent() + execAndCheck(0, generateCmdUpdateYes, expectedOutput) test "and writes the `introduction.md` file as expected": checkNoDiff(trackDir) @@ -59,7 +68,11 @@ proc main = removeIntro = true) test "`configlet generate` exits with 0 for valid placeholder usage with spaces": - execAndCheck(0, generateCmd, "") + const expectedOutput = fmt""" + Outdated: exercises/concept/bird-count/.docs/introduction.md + Generated 1 file + """.unindent() + execAndCheck(0, generateCmdUpdateYes, expectedOutput) test "and writes the `introduction.md` file as expected": checkNoDiff(trackDir)