-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Can confirm the npm is swallowing standard streams in test scr…
…ipts.
- Loading branch information
Anadian
committed
Jun 20, 2020
1 parent
834d96d
commit 5f1e432
Showing
10 changed files
with
121 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,71 @@ | ||
#!/bin/bash | ||
declare -A test_results; | ||
all_test_passed=1; | ||
# Test: HelpData | ||
test_name='HelpData'; | ||
test_results[$test_name]=0; | ||
echo 'node source/main.js -Vhc'; | ||
node source/main.js -Vhc 1>temp_stdout.txt 2>temp_stderr.txt; | ||
test_code=$?; | ||
test_stdout=`cat temp_stdout.txt`; | ||
test_stderr=`cat temp_stderr.txt`; | ||
rm temp_stdout.txt temp_stderr.txt; | ||
if [[ $test_code ]]; then | ||
test_results[$test_name]=1; | ||
else | ||
test_results[$test_name]=0; | ||
echo "Test: $test_name failed with erroneous exit code $test_code (stderr: '$test_stderr')"; | ||
fi | ||
rm temp_stderr.txt; | ||
node -p 'const FileSystem = require("fs"); FileSystem.writeSync(2, "something");' 2>temp_stderr.txt; | ||
echo "stdout: stderr: $(cat temp_stderr.txt)"; | ||
# env; | ||
# echo $0 $SHELL; | ||
# # which node; | ||
# # tty; | ||
# # uname -a; | ||
# # whoami; | ||
# declare -A test_results; | ||
# all_test_passed=1; | ||
# # Test: HelpData | ||
# test_name='HelpData'; | ||
# test_results[$test_name]=0; | ||
# echo 'node source/main.js -Vhc'; | ||
# node source/main.js -Vhc 1>temp_stdout.txt 2>temp_stderr.txt; | ||
# test_code=$?; | ||
# test_stdout=`cat temp_stdout.txt`; | ||
# test_stderr=`cat temp_stderr.txt`; | ||
# # rm temp_stdout.txt temp_stderr.txt; | ||
# if [[ $test_code ]]; then | ||
# test_results[$test_name]=1; | ||
# echo "Test: $test_name passed. (stdout: '$test_stdout' stderr: '$test_stderr')"; | ||
# else | ||
# test_results[$test_name]=0; | ||
# echo "Test: $test_name failed with erroneous exit code $test_code (stderr: '$test_stderr')"; | ||
# fi | ||
|
||
# Test: InputRegexStringToSTDOUT | ||
test_name='InputRegexStringToSTDOUT'; | ||
test_results[$test_name]=0; | ||
node source/main.js --input-regex-string 'pcre/(simple)? regex/replace/vim' -o 1>temp_stdout.txt 2>temp_stderr.txt; | ||
test_code=$?; | ||
test_stdout=`cat temp_stdout.txt`; | ||
test_stderr=`cat temp_stderr.txt`; | ||
rm temp_stdout.txt temp_stderr.txt; | ||
expected_stdout='\(simple\)\= regex'; | ||
if [[ $test_code ]]; then | ||
echo $test_stdout; | ||
if [[ "$test_stdout" == "$expected_stdout" ]]; then | ||
test_results[$test_name]=1; | ||
echo "Test: $test_name passed."; | ||
else | ||
test_results[$test_name]=0; | ||
echo "Test: $test_name failed: actual stdout: '$test_stdout' didn't match expected stdout: '$expected_stdout' (stderr: '$test_stderr')"; | ||
fi | ||
else | ||
test_results[help_data]=0; | ||
echo "Test: $test_name returned an erroneous exit code: $test_code stderr: '$test_stderr'"; | ||
fi | ||
# $1est_name='InputRegexStringToSTDOUT'; | ||
# $1est_results[$test_name]=0; | ||
# $1ode source/main.js --input-regex-string 'pcre/(simple)? regex/replace/vim' -o 1>temp_stdout.txt 2>temp_stderr.txt; | ||
# $1est_code=$?; | ||
# $1est_stdout=`cat temp_stdout.txt`; | ||
# $1est_stderr=`cat temp_stderr.txt`; | ||
# $1 rm temp_stdout.txt temp_stderr.txt; | ||
# $1xpected_stdout='\(simple\)\= regex'; | ||
# $1f [[ $test_code ]]; then | ||
# $1echo $test_stdout; | ||
# $1if [[ "$test_stdout" == "$expected_stdout" ]]; then | ||
# $1 test_results[$test_name]=1; | ||
# $1 echo "Test: $test_name passed."; | ||
# $1else | ||
# $1 test_results[$test_name]=0; | ||
# $1 echo "Test: $test_name failed: actual stdout: '$test_stdout' didn't match expected stdout: '$expected_stdout' (stderr: '$test_stderr')"; | ||
# $1fi | ||
# $1lse | ||
# $1test_results[help_data]=0; | ||
# $1echo "Test: $test_name returned an erroneous exit code: $test_code stderr: '$test_stderr'"; | ||
# $1i | ||
|
||
# Test: InputFileToOutputFile | ||
test_name='InputFileToOutputFile'; | ||
test_results[$test_name]=0; | ||
echo ':([-0-9A-Za-z_ ]*)?:([0-9A-Za-z_]+)?:(([-0-9A-Za-z]+)(=([0-9A-Za-z]))?)?:(0|(([NIRBWAUFDnirbwaufd])[^!?=;]*([!?])(=(((\|)|(([-0-9A-Za-z_.\/\\ ]+)([!?])?)))+)?));' > temp_input.txt; | ||
echo $'node source/main.js -vx --input temp_input.txt --input-flavour \'pcre\' --output-flavour \'vim\' --output \'temp_output.txt\''; | ||
node source/main.js -vx --input temp_input.txt --input-flavour 'pcre' --output-flavour 'vim' --output 'temp_output.txt' 1>temp_stdout.txt 2>temp_stderr.txt; | ||
test_code=$?; | ||
test_stdout=`cat temp_stdout.txt`; | ||
test_stderr=`cat temp_stderr.txt`; | ||
rm temp_stdout.txt temp_stderr.txt; | ||
if [[ $test_code ]]; then | ||
cat temp_output.txt; | ||
else | ||
test_results[$test_name]=0; | ||
echo "Test: $test_name failed with erroneous exit code $test_code (stderr: '$test_stderr')"; | ||
fi | ||
# $1est_name='InputFileToOutputFile'; | ||
# $1est_results[$test_name]=0; | ||
# $1cho ':([-0-9A-Za-z_ ]*)?:([0-9A-Za-z_]+)?:(([-0-9A-Za-z]+)(=([0-9A-Za-z]))?)?:(0|(([NIRBWAUFDnirbwaufd])[^!?=;]*([!?])(=(((\|)|(([-0-9A-Za-z_.\/\\ ]+)([!?])?)))+)?));' > temp_input.txt; | ||
# $1cho $'node source/main.js -vx --input temp_input.txt --input-flavour \'pcre\' --output-flavour \'vim\' --output \'temp_output.txt\''; | ||
# $1ode source/main.js -vx --input temp_input.txt --input-flavour 'pcre' --output-flavour 'vim' --output 'temp_output.txt' 1>temp_stdout.txt 2>temp_stderr.txt; | ||
# $1est_code=$?; | ||
# $1est_stdout=`cat temp_stdout.txt`; | ||
# $1est_stderr=`cat temp_stderr.txt`; | ||
# $1xpected_output_data=':\([-0-9A-Za-z_ ]*\)\=:\([0-9A-Za-z_]\+\)\=:\(\([-0-9A-Za-z]\+\)\(=\([0-9A-Za-z]\)\)\=\)\=:\(0\|\(\([NIRBWAUFDnirbwaufd]\)[^!\==;]*\([!\=]\)\(=\(\(\(|\)\|\(\([-0-9A-Za-z_.\/\\ ]\+\)\([!\=]\)\=\)\)\)\+\)\=\)\);\r'; | ||
# $1m temp_stdout.txt temp_stderr.txt; | ||
# $1f [[ $test_code ]]; then | ||
# $1output_data=`cat temp_output.txt`; | ||
|
||
# $1lse | ||
# $1test_results[$test_name]=0; | ||
# $1echo "Test: $test_name failed with erroneous exit code $test_code (stderr: '$test_stderr')"; | ||
# $1i | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
./cli_test.sh; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.