@@ -8,24 +8,24 @@ bold "Test: It should compile"
88if rewatch clean & > /dev/null;
99then
1010 success " Repo Cleaned"
11- else
11+ else
1212 error " Error Cleaning Repo"
1313 exit 1
1414fi
1515
16- if rewatch & > /dev/null;
16+ if rewatch & > /dev/null;
1717then
1818 success " Repo Built"
19- else
19+ else
2020 error " Error Building Repo"
2121 exit 1
2222fi
2323
2424
25- if git diff --exit-code ./;
25+ if git diff --exit-code ./;
2626then
2727 success " Testrepo has no changes"
28- else
28+ else
2929 error " Build has changed"
3030 exit 1
3131fi
@@ -35,6 +35,21 @@ node ./packages/main/src/Main.mjs > ./packages/main/src/output.txt
3535mv ./packages/main/src/Main.res ./packages/main/src/Main2.res
3636rewatch build --no-timing=true & > ../tests/snapshots/rename-file.txt
3737mv ./packages/main/src/Main2.res ./packages/main/src/Main.res
38+
39+ # Rename a file with a dependent - this should trigger an error
40+ mv ./packages/main/src/InternalDep.res ./packages/main/src/InternalDep2.res
41+ rewatch build --no-timing=true & > ../tests/snapshots/rename-file-internal-dep.txt
42+ # replace the absolute path so the snapshot is the same on all machines
43+ replace " s/$( pwd | sed " s/\//\\\\ \//g" ) //g" ../tests/snapshots/rename-file-internal-dep.txt
44+ mv ./packages/main/src/InternalDep2.res ./packages/main/src/InternalDep.res
45+
46+ # Rename a file with a dependent in a namespaced package - this should trigger an error (regression)
47+ mv ./packages/new-namespace/src/Other_module.res ./packages/new-namespace/src/Other_module2.res
48+ rewatch build --no-timing=true & > ../tests/snapshots/rename-file-internal-dep-namespace.txt
49+ # replace the absolute path so the snapshot is the same on all machines
50+ replace " s/$( pwd | sed " s/\//\\\\ \//g" ) //g" ../tests/snapshots/rename-file-internal-dep-namespace.txt
51+ mv ./packages/new-namespace/src/Other_module2.res ./packages/new-namespace/src/Other_module.res
52+
3853rewatch build & > /dev/null
3954mv ./packages/main/src/ModuleWithInterface.resi ./packages/main/src/ModuleWithInterface2.resi
4055rewatch build --no-timing=true & > ../tests/snapshots/rename-interface-file.txt
@@ -66,10 +81,10 @@ git checkout -- packages/new-namespace/src/NS_alias.res
6681rewatch build & > /dev/null
6782
6883# make sure we don't have changes in the test repo
69- if git diff --exit-code ./;
84+ if git diff --exit-code ./;
7085then
7186 success " Output is correct"
72- else
87+ else
7388 error " Output is incorrect"
7489 exit 1
7590fi
@@ -81,18 +96,18 @@ new_files=$(git ls-files --others --exclude-standard ./)
8196if [[ $new_files = " " ]];
8297then
8398 success " No new files created"
84- else
99+ else
85100 error " ❌ - New files created"
86101 printf " ${new_files} \n"
87102 exit 1
88103fi
89104
90105# see if the snapshots have changed
91106changed_snapshots=$( git ls-files --modified ../tests/snapshots)
92- if git diff --exit-code ../tests/snapshots & > /dev/null;
107+ if git diff --exit-code ../tests/snapshots & > /dev/null;
93108then
94109 success " Snapshots are correct"
95- else
110+ else
96111 error " Snapshots are incorrect:"
97112 # print filenames in the snapshot dir call bold with the filename
98113 # and then cat their contents
105120 done
106121
107122 exit 1
108- fi
123+ fi
0 commit comments