exercism / snippet-extractor

GNU Affero General Public License v3.0
1 stars 25 forks source link

Snippets for new batch track #113

Closed GroophyLifefor closed 2 months ago

GroophyLifefor commented 2 months ago

Hi @ErikSchierboom , Here mine snippet comment configuration. Can you review please 😄

ErikSchierboom commented 2 months ago

You're missing the tests: https://github.com/exercism/snippet-extractor?tab=readme-ov-file#add-golden-tests

GroophyLifefor commented 2 months ago

How can I see generated snippet to find problem ?

GroophyLifefor commented 2 months ago

my expected was

@echo off

SET source_dir=C:\Users\Username\Documents
SET backup_dir=D:\Backup

echo Starting backup...

IF NOT EXIST "%source_dir%" (
    echo Source not found. Exiting...
    exit /b
)

IF NOT EXIST "%backup_dir%" (
    echo Creating backup directory...
    mkdir "%backup_dir%"
)

xcopy "%source_dir%\*" "%backup_dir%\" /E /I /Y

echo Backup complete.
pause

but the tool waits

@echo off

SET source_dir=C:\\Users\\Username\\Documents
SET backup_dir=D:\\Backup

echo Starting backup...

IF NOT EXIST \"%source_dir%\" (
    echo Source not found. Exiting...
    exit /b
)

IF NOT EXIST \"%backup_dir%\" (
    echo Creating backup directory...    mkdir \"%backup_dir%\"
)

xcopy \"%source_dir%\\*\" \"%backup_dir%\\\" /E /I /Y

echo Backup complete.
pause

tool output:

Fabulous run in 0.100297s, 1615.1980 runs/s, 1625.1684 assertions/s.

  1) Failure:
SnippetExtractor::LanguagesTest#test_batch_full [test/languages_test.rb:12]:
Expected: "@echo off\n\nSET source_dir=C:\\Users\\Username\\Documents\nSET backup_dir=D:\\Backup\n\necho Starting backup...\n\nIF NOT EXIST \"%source_dir%\" (\n    echo Source not found. Exiting...\n    exit /b\n)\n\nIF NOT EXIST \"%backup_dir%\" (\n    echo Creating backup directory...\n    mkdir \"%backup_dir%\"\n)\n\nxcopy \"%source_dir%\\*\" \"%backup_dir%\\\" /E /I /Y\n\necho Backup complete.\npause"
  Actual: "@echo off\n\nSET source_dir=C:\\Users\\Username\\Documents\nSET backup_dir=D:\\Backup\n\necho Starting backup...\n\nIF NOT EXIST \"%source_dir%\" (\n    echo Source not found. Exiting...\n    exit /b"

  2) Failure:
SnippetExtractor::LanguagesTest#test_batch_extended [test/languages_test.rb:12]:
Expected: "@echo off\\n\\nSET source_dir=C:\\\\Users\\\\Username\\\\Documents\\nSET backup_dir=D:\\\\Backup\\n\\necho Starting backup...\\n\\nIF NOT EXIST \\\"%source_dir%\\\" (\\n    echo Source not found. Exiting...\\n    exit /b\\n)\\n\\nIF NOT EXIST \\\"%backup_dir%\\\" (\\n    echo Creating backup directory...    mkdir \\\"%backup_dir%\\\"\\n)\\n\\nxcopy \\\"%source_dir%\\\\*\\\" \\\"%backup_dir%\\\\\\\" /E /I /Y\\n\\necho Backup complete.\\npause"
  Actual: "@echo off\n\nSET source_dir=C:\\Users\\Username\\Documents\nSET backup_dir=D:\\Backup\n\necho Starting backup...\n\nIF NOT EXIST \"%source_dir%\" (\n    echo Source not found. Exiting...\n    exit /b"

162 runs, 163 assertions, 2 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1)

I'm a little bit confused.

ErikSchierboom commented 2 months ago

Did you look at the actual value in the output?

GroophyLifefor commented 2 months ago

Did you look at the actual value in the output?

I do and I see that, in the exit /b\n ) part, parsing got stop, but code not ends

ErikSchierboom commented 2 months ago

Could you please read the README carefully to understand what exactly the snippet extractor is doing?

iHiD commented 2 months ago

Specifically, I think you've missed: "the snippet extractor extracts the first ten "interesting" (non-empty) lines of code"

GroophyLifefor commented 2 months ago

YAY, IT'S PASSED 😄