-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧪 - Add tests and improve test suite
- Loading branch information
Showing
16 changed files
with
190 additions
and
91 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
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,9 @@ | ||
// Generated by ReScript, PLEASE EDIT WITH CARE | ||
|
||
|
||
var hello = "world"; | ||
|
||
export { | ||
hello , | ||
} | ||
/* No side effect */ |
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 @@ | ||
type hello = string | ||
let hello = "world" |
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 @@ | ||
type hello | ||
let hello: hello |
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,37 +1,77 @@ | ||
echo "Test: It should compile" | ||
source "./utils.sh" | ||
cd ../testrepo | ||
|
||
if RUST_BACKTRACE=1 ../target/release/rewatch clean .; | ||
bold "Test: It should compile" | ||
|
||
if rewatch clean &> /dev/null; | ||
then | ||
echo "✅ - Repo Cleaned" | ||
success "Repo Cleaned" | ||
else | ||
echo "❌ - Error Cleaning Repo" | ||
error "Error Cleaning Repo" | ||
exit 1 | ||
fi | ||
|
||
if RUST_BACKTRACE=1 ../target/release/rewatch build .; | ||
if rewatch &> /dev/null; | ||
then | ||
echo "✅ - Repo Built" | ||
success "Repo Built" | ||
else | ||
echo "❌ - Error Building Repo" | ||
error "Error Building Repo" | ||
exit 1 | ||
fi | ||
|
||
|
||
if git diff --exit-code ./; | ||
then | ||
echo "✅ - Testrepo has no changes" | ||
success "Testrepo has no changes" | ||
else | ||
echo "❌ - Build has changed" | ||
error "Build has changed" | ||
exit 1 | ||
fi | ||
|
||
node ./packages/main/src/Main.mjs > ./packages/main/src/output.txt | ||
|
||
mv ./packages/main/src/Main.res ./packages/main/src/Main2.res | ||
rewatch build --no-timing=true &> ../tests/snapshots/rename-file.txt | ||
mv ./packages/main/src/Main2.res ./packages/main/src/Main.res | ||
rewatch build &> /dev/null | ||
mv ./packages/main/src/ModuleWithInterface.resi ./packages/main/src/ModuleWithInterface2.resi | ||
rewatch build --no-timing=true &> ../tests/snapshots/rename-interface-file.txt | ||
mv ./packages/main/src/ModuleWithInterface2.resi ./packages/main/src/ModuleWithInterface.resi | ||
rewatch build &> /dev/null | ||
mv ./packages/main/src/ModuleWithInterface.res ./packages/main/src/ModuleWithInterface2.res | ||
rewatch build --no-timing=true &> ../tests/snapshots/rename-file-with-interface.txt | ||
mv ./packages/main/src/ModuleWithInterface2.res ./packages/main/src/ModuleWithInterface.res | ||
rewatch build &> /dev/null | ||
|
||
# make sure we don't have changes in the test repo | ||
if git diff --exit-code ./; | ||
then | ||
echo "✅ - Output is correct" | ||
success "Output is correct" | ||
else | ||
echo "❌ - Output is incorrect" | ||
error "Output is incorrect" | ||
exit 1 | ||
fi | ||
|
||
# make sure there are no new files created by the build | ||
# this could happen because of not cleaning up .mjs files | ||
# after we rename files | ||
new_files=$(git ls-files --others --exclude-standard ./) | ||
if [[ $new_files = "" ]]; | ||
then | ||
success "No new files created" | ||
else | ||
error "❌ - New files created" | ||
printf "${new_files}\n" | ||
exit 1 | ||
fi | ||
|
||
# see if the snapshots have changed | ||
changed_snapshots=$(git ls-files --modified ../tests/snapshots) | ||
if git diff --exit-code ../tests/snapshots &> /dev/null; | ||
then | ||
success "Snapshots are correct" | ||
else | ||
error "Snapshots are incorrect:" | ||
printf "${changed_snapshots}\n" | ||
exit 1 | ||
fi |
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 |
---|---|---|
@@ -1,31 +1,26 @@ | ||
#!/bin/bash | ||
source ./utils.sh | ||
|
||
# Make sure we are in the right directory | ||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) | ||
cd "$parent_path" | ||
|
||
bold () { echo -e "\033[1m$1\033[0m"; } | ||
overwrite() { echo -e "\r\033[1A\033[0K$@"; } | ||
cd $(dirname $0) | ||
|
||
bold "Check if build exists" | ||
if test -f ../target/release/rewatch; | ||
then | ||
echo "✅ - Build exists" | ||
success "Build exists" | ||
else | ||
echo "❌ - Build does not exist. Exiting..." | ||
error "Build does not exist. Exiting..." | ||
exit 1 | ||
fi | ||
|
||
bold "Make sure the testrepo is clean" | ||
if git diff --exit-code ../testrepo &> /dev/null; | ||
then | ||
overwrite "✅ - Testrepo has no changes" | ||
success "Testrepo has no changes" | ||
else | ||
overwrite "❌ - Testrepo is not clean to start with" | ||
error "Testrepo is not clean to start with" | ||
exit 1 | ||
fi | ||
|
||
./compile.sh && ./watch.sh | ||
|
||
bold "Running Tests" | ||
./compile.sh | ||
./watch--change-file.sh |
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,10 +1,3 @@ | ||
# This file is needed for local development. It makes sure we kill all the | ||
# subprocesses that are hanging around after the main tests get killed, as the | ||
# watcher will need to run in the background. | ||
|
||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT | ||
|
||
#!/bin/bash | ||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) | ||
cd "$parent_path" | ||
cd $(dirname $0) | ||
./suite-ci.sh |
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,6 @@ | ||
#!/bin/bash | ||
overwrite() { echo -e "\r\033[1A\033[0K$@"; } | ||
success() { echo -e "- ✅ \033[32m$1\033[0m"; } | ||
error() { echo -e "- 🛑 \033[31m$1\033[0m"; } | ||
bold() { echo -e "\033[1m$1\033[0m"; } | ||
rewatch() { RUST_BACKTRACE=1 ../target/release/rewatch --no-timing=true $1; } |
Oops, something went wrong.