Skip to content

Commit

Permalink
windows implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
GroophyLifefor committed Aug 4, 2024
1 parent 9095c5b commit 3386d2a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 43 deletions.
42 changes: 36 additions & 6 deletions bin/test-runner.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
@echo off
setlocal EnableDelayedExpansion

set slug=%~1
set processed_name=%~2
cd..
set configPath=config.json

cd exercises
cd practice
cd %slug%
call %processed_name%Test.bat test-runner
for /f "usebackq tokens=*" %%a in ("%configPath%") do (
set "line=%%a"

REM Look for lines containing the slug
echo !line! | findstr /c:"\"slug\"" >nul
if !errorlevel! equ 0 (
set "_slug=!line:*\"slug\": \"=!"
set "_slug=!_slug:\"",=!"
set "_slug=!_slug:\"",=!"
)

REM Look for lines containing the name
echo !line! | findstr /c:"\"name\"" >nul
if !errorlevel! equ 0 (
set "_name=!line:*\"name\": \"=!"
set "_name=!_name:\"",=!"
set "_name=!_name:\"",=!"
for /f "tokens=2 delims=:" %%a in ('echo !_slug!') do set "slug=%%a"
set "slug=!slug:~2,-2!"
for /f "tokens=2 delims=:" %%a in ('echo !_name!') do set "name=%%a"
set "name=!name:~2,-2!"


echo Slug: !slug!
echo Name: !name!
echo Exec: call exercises/practice/!slug!/!name: =!Test.bat test-runner
call exercises/practice/!slug!/!name: =!Test.bat test-runner
echo.

)
)

endlocal
37 changes: 0 additions & 37 deletions bin/test-runner.sh

This file was deleted.

0 comments on commit 3386d2a

Please sign in to comment.