Skip to content

Commit

Permalink
Change test driver and scripts to use .ipt.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaby76 committed Jul 23, 2024
1 parent a9167fd commit c6307d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion _scripts/templates/CSharp/st.Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static void DoParse(ICharStream str, string input_name, int row_number)
{
if (tee)
{
System.IO.File.WriteAllText(input_name + ".tree", ToStringTree(tree, parser));
System.IO.File.WriteAllText(input_name + ".ipt", ToStringTree(tree, parser));
} else
{
System.Console.Error.WriteLine(ToStringTree(tree, parser));
Expand Down
10 changes: 5 additions & 5 deletions _scripts/templates/CSharp/st.test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ $Tests = "<if(os_win)>../<example_files_win><else>../<example_files_unix><endif>
Write-Host "Test cases here: $Tests"

# Get a list of test files from the test directory. Do not include any
# .errors or .tree files. Pay close attention to remove only file names
# that end with the suffix .errors or .tree.
# .errors or .ipt files. Pay close attention to remove only file names
# that end with the suffix .errors or .ipt.
if (Test-Path -Path "tests.txt" -PathType Leaf) {
Remove-Item "tests.txt"
}
Expand All @@ -17,7 +17,7 @@ foreach ($file in $allFiles) {
continue
} elseif ($ext -eq ".errors") {
continue
} elseif ($ext -eq ".tree") {
} elseif ($ext -eq ".ipt") {
continue
} else {
$(& dotnet triconv -- -f utf-8 $file ; $last = $LASTEXITCODE ) | Out-Null
Expand Down Expand Up @@ -69,7 +69,7 @@ if ( $size -eq 0 ) {
$old = Get-Location
Set-Location ..

# Check if any .errors/.tree files have changed. That's not good.
# Check if any .errors/.ipt files have changed. That's not good.
git config --global pager.diff false
Remove-Item -Force -Path $old/updated.txt -errorAction ignore 2>&1 | Out-Null
$updated = 0
Expand All @@ -87,7 +87,7 @@ foreach ($item in Get-ChildItem . -Recurse) {
foreach ($item in Get-ChildItem . -Recurse) {
$file = $item.fullname
$ext = $item.Extension
if ($ext -eq ".tree") {
if ($ext -eq ".ipt") {
git diff --exit-code $file *>> $old/updated.txt
$st = $LASTEXITCODE
if ($st -ne 0) {
Expand Down
17 changes: 9 additions & 8 deletions _scripts/templates/CSharp/st.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

# Get a list of test files from the test directory. Do not include any
# .errors or .tree files. Pay close attention to remove only file names
# that end with the suffix .errors or .tree.
# .errors or .ipt files. Pay close attention to remove only file names
# that end with the suffix .errors or .ipt.
if [ "$global" == "" ]
then
files2=`dotnet trglob -- '../<example_files_unix>' | grep -v '.errors$' | grep -v '.tree$'`
files2=`dotnet trglob -- '../<example_files_unix>' | grep -v '.errors$' | grep -v '.ipt$'`
else
files2=`trglob '../<example_files_unix>' | grep -v '.errors$' | grep -v '.tree$'`
files2=`trglob '../<example_files_unix>' | grep -v '.errors$' | grep -v '.ipt$'`
fi

files=()
Expand Down Expand Up @@ -92,9 +92,10 @@ then
exit 1
fi

# rm -rf `find ../<example_files_unix> -type f -name '*.errors' -o -name '*.tree' -size 0`
# rm -rf `find ../<example_files_unix> -type f -name '*.errors' -o
# -name '*.ipt' -size 0`

# For Unix environments, convert the newline in the .errors and .trees
# For Unix environments, convert the newline in the .errors and .ipts
# to Unix style.
unameOut="$(uname -s)"
case "${unameOut}" in
Expand All @@ -106,7 +107,7 @@ case "${unameOut}" in
esac
if [[ "$machine" == "MinGw" || "$machine" == "Msys" || "$machine" == "Cygwin" || "#machine" == "Linux" ]]
then
gen=`find ../<example_files_unix> -type f -name '*.errors' -o -name '*.tree'`
gen=`find ../<example_files_unix> -type f -name '*.errors' -o -name '*.ipt'`
if [ "$gen" != "" ]
then
dos2unix $gen
Expand All @@ -129,7 +130,7 @@ do
updated=$xxx
fi
done
for f in `find . -name '*.tree'`
for f in `find . -name '*.ipt'`
do
git diff --exit-code $f >> $old/updated.txt 2>&1
xxx=$?
Expand Down

0 comments on commit c6307d1

Please sign in to comment.