Skip to content

Commit a77a249

Browse files
committed
runtest stripall
1 parent 765bdd6 commit a77a249

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/runtests.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ function courseCheck(age, field, GPA, courses, id)
3636
return any(in.(courses, Ref(relevant)))
3737
end
3838

39+
stripall(x::String) = replace(x, r"\s|\n"=>"")
40+
3941
@testset "constructor" begin
4042

4143
P1 = Person(age=24, field="Mechanical Engineering", courses=["Artificial Intelligence", "Robotics"], id = 1)
@@ -47,26 +49,26 @@ end
4749

4850
D = Doc(university = U)
4951

50-
@test @capture_out(print(P1.aml)) == @capture_out(print(strip("""
52+
@test stripall(@capture_out(pprint(P1))) == stripall("""
5153
<person id="1">
5254
<age>24</age>
5355
<study-field>Mechanical Engineering</study-field>
5456
<GPA>4.5</GPA>
5557
<taken-courses>Artificial Intelligence</taken-courses>
5658
<taken-courses>Robotics</taken-courses>
5759
</person>
58-
""")))
60+
""")
5961

60-
@test @capture_out(print(P2.aml)) == print(strip("""
62+
@test stripall(@capture_out(pprint(P2))) == stripall("""
6163
<person id="2">
6264
<age>18</age>
6365
<study-field>Computer Engineering</study-field>
6466
<GPA>4.2</GPA>
6567
<taken-courses>Julia</taken-courses>
6668
</person>
67-
"""))
69+
""")
6870

69-
@test @capture_out(print(U.aml)) == print(strip("""
71+
@test stripall(@capture_out(pprint(U.aml))) == stripall("""
7072
<university university-name="Julia University">
7173
<person id="1">
7274
<age>24</age>
@@ -82,9 +84,9 @@ end
8284
<taken-courses>Julia</taken-courses>
8385
</person>
8486
</university>
85-
"""))
87+
""")
8688

87-
@test @capture_out(print(D.aml)) == print(strip("""
89+
@test stripall(@capture_out(pprint(D))) == stripall("""
8890
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
8991
<university university-name="Julia University">
9092
<person id="1">
@@ -101,7 +103,7 @@ end
101103
<taken-courses>Julia</taken-courses>
102104
</person>
103105
</university>
104-
"""))
106+
""")
105107

106108

107109
end
@@ -150,13 +152,13 @@ end
150152

151153
P2 = U.people[2]
152154

153-
@test @capture_out(print(P2.aml)) == print(strip("""
155+
@test stripall(@capture_out(pprint(P2))) == stripall("""
154156
<person id="2">
155157
<age>18</age>
156158
<study-field>Computer Engineering</study-field>
157159
<GPA>4</GPA>
158160
<taken-courses>Julia</taken-courses>
159161
</person>
160-
"""))
162+
""")
161163

162164
end

0 commit comments

Comments
 (0)