-
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.
- Loading branch information
1 parent
591eaf1
commit d5df4a5
Showing
5 changed files
with
53 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -29,4 +29,6 @@ | |
|
||
/gh-pages/ | ||
|
||
_dev | ||
_dev | ||
|
||
/tst/files/doc/ |
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,9 @@ | ||
# Introduction | ||
The files in this directory are used to post-process test files | ||
that are extracted from the documentation examples. | ||
|
||
# Main Files | ||
- `processTests.sh` : processes all doc tests and moves them into `tst/files/doc`. | ||
|
||
# Instructions | ||
In order to post-process the tests and move them into `tst/files/doc` automatically, one needs to execute `processTests.sh` from any place. |
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,37 @@ | ||
#!/bin/bash | ||
|
||
# go to root of repo | ||
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
cd $script_dir/../.. | ||
echo "Working in folder $(pwd)" | ||
|
||
# get operating system | ||
unameOut="$(uname -s)" | ||
case "${unameOut}" in | ||
Linux*) machine=Linux;; | ||
Darwin*) machine=Mac;; | ||
CYGWIN*) machine=Cygwin;; | ||
MINGW*) machine=MinGw;; | ||
*) machine="UNKNOWN:${unameOut}" | ||
esac | ||
|
||
|
||
# Post-processing for the extracted examples from the documentation. | ||
# - Add a "\n" to all Print executions. | ||
# - Move files into test_dir | ||
test_dir="tst/files/doc" | ||
mkdir -p $test_dir | ||
files=($(ls -1 tst/lins*.tst)) | ||
echo "Found ${#files[@]} test file(s)" | ||
for file in ${files[@]}; do | ||
echo "Processing $file" | ||
if [ "${machine}" == "Mac" ]; then | ||
sed -i "" 's|Print(\(.*\));|Print(\1, \"\\n\");|g' $file | ||
elif [ "${machine}" == "Linux" ]; then | ||
sed -i 's|Print(\(.*\));|Print(\1, \"\\n\");|g' $file | ||
else | ||
echo "ERROR: Unsupported operating system ${machine}" | ||
exit 1 | ||
fi; | ||
mv $file $test_dir/${file#"tst/"} | ||
done |
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