Тестирую с временным файлом
This commit is contained in:
parent
a354c34e1d
commit
a6ecfb510b
1 changed files with 9 additions and 13 deletions
20
.github/workflows/compile-and-test.yml
vendored
20
.github/workflows/compile-and-test.yml
vendored
|
@ -45,7 +45,6 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Проверяем, что есть папка t/ с тестовыми файлами
|
|
||||||
if [ ! -d "t" ]; then
|
if [ ! -d "t" ]; then
|
||||||
echo "::error::Directory 't' with test files not found"
|
echo "::error::Directory 't' with test files not found"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -55,19 +54,16 @@ jobs:
|
||||||
echo "------------------------------------"
|
echo "------------------------------------"
|
||||||
echo "Testing with file: $file"
|
echo "Testing with file: $file"
|
||||||
|
|
||||||
# Способ 1. Передавать через временный файл
|
# Создаём временный файл с "0" и именем тестового файла:
|
||||||
# echo "0" > test_input.txt
|
echo "0" > test_input.txt
|
||||||
# echo "$file" >> test_input.txt
|
echo "$file" >> test_input.txt
|
||||||
# echo "=== Test input ==="
|
|
||||||
# cat test_input.txt
|
|
||||||
# echo "=================="
|
|
||||||
# ./a.out < test_input.txt
|
|
||||||
|
|
||||||
# Способ 2. Через printf (важно экранировать %s и $file)
|
echo "==== DEBUG test_input.txt ===="
|
||||||
printf "0\n%s\n" "$file" | ./a.out
|
cat -A test_input.txt
|
||||||
# Или можно так (если хотите увидеть ввод на экране лога):
|
echo "=============================="
|
||||||
echo -e "0\n$file\n" | ./a.out
|
|
||||||
|
|
||||||
|
# Теперь фидим это stdin
|
||||||
|
./a.out < test_input.txt
|
||||||
status=$?
|
status=$?
|
||||||
echo "Exit code: $status"
|
echo "Exit code: $status"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue