test more invalid inputs in autofix cli

This commit is contained in:
WebFreak001 2023-07-09 12:54:43 +02:00
parent ff75ccebfd
commit 087d886c60
No known key found for this signature in database
GPG Key ID: AEFC88D11109D1AA
2 changed files with 9 additions and 1 deletions

View File

@ -616,7 +616,7 @@ private struct UserSelect
throw new Exception("Selected option number out of range."); throw new Exception("Selected option number out of range.");
return item; return item;
} }
catch (ConvException e) catch (Exception e)
{ {
writeln("Invalid selection, try again. ", e.message); writeln("Invalid selection, try again. ", e.message);
} }

View File

@ -27,6 +27,10 @@ echo '2. test no changes for simple enter pressing'
cp -v it/autofix_cli/source.d it/autofix_cli/test.d cp -v it/autofix_cli/source.d it/autofix_cli/test.d
printf "\n" | ../bin/dscanner fix it/autofix_cli/test.d printf "\n" | ../bin/dscanner fix it/autofix_cli/test.d
diff it/autofix_cli/test.d it/autofix_cli/source.d diff it/autofix_cli/test.d it/autofix_cli/source.d
echo '2.1. test no changes entering 0'
cp -v it/autofix_cli/source.d it/autofix_cli/test.d
printf "0\n" | ../bin/dscanner fix it/autofix_cli/test.d
diff it/autofix_cli/test.d it/autofix_cli/source.d
echo '3. test change applies automatically with --applySingle' echo '3. test change applies automatically with --applySingle'
cp -v it/autofix_cli/source.d it/autofix_cli/test.d cp -v it/autofix_cli/source.d it/autofix_cli/test.d
../bin/dscanner fix --applySingle it/autofix_cli/test.d | grep -F 'Writing changes to it/autofix_cli/test.d' ../bin/dscanner fix --applySingle it/autofix_cli/test.d | grep -F 'Writing changes to it/autofix_cli/test.d'
@ -35,4 +39,8 @@ echo '4. test change apply when entering "1"'
cp -v it/autofix_cli/source.d it/autofix_cli/test.d cp -v it/autofix_cli/source.d it/autofix_cli/test.d
printf "1\n" | ../bin/dscanner fix it/autofix_cli/test.d | grep -F 'Writing changes to it/autofix_cli/test.d' printf "1\n" | ../bin/dscanner fix it/autofix_cli/test.d | grep -F 'Writing changes to it/autofix_cli/test.d'
diff it/autofix_cli/test.d it/autofix_cli/fixed.d diff it/autofix_cli/test.d it/autofix_cli/fixed.d
echo '5. test invalid selection reasks what to apply'
cp -v it/autofix_cli/source.d it/autofix_cli/test.d
printf "2\n-1\n1000\na\n1\n" | ../bin/dscanner fix it/autofix_cli/test.d | grep -F 'Writing changes to it/autofix_cli/test.d'
diff it/autofix_cli/test.d it/autofix_cli/fixed.d