Skip to content

Commit a469c8c

Browse files
authored
Move Test.NoPeeking.Solutions outside of compilation path during solutions reset (#276)
* Ch5 - enable solutions reset * additional fixup note * resetSolutions.sh now relocates no-peeking * Ch2 - instructions to track moved no-peeking dirs
1 parent b75515f commit a469c8c

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

exercises/chapter5/test/Main.purs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Test.Main where
22

33
import Prelude hiding (gcd)
44
import Test.MySolutions
5-
import Test.NoPeeking.Solutions
5+
import Test.NoPeeking.Solutions -- Note to reader: Delete this line
66

77
import ChapterExamples (Amp(..), current, fromString, gcd, gcdV2, isEmpty, livesInLA, lzs, partialFunction, showPerson, showPersonV2, sortPair, takeFive, toString, unknownPerson)
88
import Data.Int (round)
@@ -121,6 +121,8 @@ Note to reader: Delete this line to expand comment block -}
121121
$ round $ area $ Text origin "Text has no area!"
122122
test "Exercise - Clipped shapeBounds" do
123123
Assert.equal { top: -2.0, left: -2.0, right: 2.0, bottom: 2.0 }
124+
-- Note to users: You'll need to manually import shapeBounds
125+
-- from Data.Picture. Don't import from Test.NoPeeking.Solutions.
124126
$ shapeBounds (Clipped samplePicture { x: 0.0, y: 0.0 } 4.0 4.0)
125127
Assert.equal { top: 3.0, left: 3.0, right: 7.0, bottom: 7.0 }
126128
$ shapeBounds (Clipped samplePicture { x: 5.0, y: 5.0 } 4.0 4.0)

scripts/resetSolutions.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#!/usr/bin/env bash
22

33
# This script automatically resets exercises so they are ready to be solved.
4-
# It just removes lines with a note to delete them.
4+
# - Removes lines with a note to delete them.
5+
# - Moves the no-peeking directory outside of the compilation path.
56

67
# For all chapters
78
for d in exercises/*; do
89
# if directory (excludes LICENSE file)
910
if [ -d $d ]; then
1011
perl -ni -e 'print if !/Note to reader: Delete this line/' $d/test/Main.purs
1112
fi
13+
# if there's a no-peeking directory
14+
if [ -d $d/test/no-peeking ]; then
15+
mv $d/test/no-peeking $d/no-peeking
16+
fi
1217
done

text/chapter2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The book repo contains PureScript example code and unit tests for the exercises
2020
cd purescript-book
2121
./scripts/resetSolutions.sh
2222
./scripts/removeAnchors.sh
23+
git add .
2324
git commit --all --message "Exercises ready to be solved"
2425
```
2526

0 commit comments

Comments
 (0)