@@ -36,6 +36,8 @@ function courseCheck(age, field, GPA, courses, id)
36
36
return any (in .(courses, Ref (relevant)))
37
37
end
38
38
39
+ stripall (x:: String ) = replace (x, r" \s |\n " => " " )
40
+
39
41
@testset " constructor" begin
40
42
41
43
P1 = Person (age= 24 , field= " Mechanical Engineering" , courses= [" Artificial Intelligence" , " Robotics" ], id = 1 )
47
49
48
50
D = Doc (university = U)
49
51
50
- @test @capture_out (print (P1. aml)) == @capture_out ( print ( strip ("""
52
+ @test stripall ( @capture_out (pprint (P1))) == stripall ("""
51
53
<person id="1">
52
54
<age>24</age>
53
55
<study-field>Mechanical Engineering</study-field>
54
56
<GPA>4.5</GPA>
55
57
<taken-courses>Artificial Intelligence</taken-courses>
56
58
<taken-courses>Robotics</taken-courses>
57
59
</person>
58
- """ )))
60
+ """ )
59
61
60
- @test @capture_out (print (P2. aml)) == print ( strip ("""
62
+ @test stripall ( @capture_out (pprint (P2))) == stripall ("""
61
63
<person id="2">
62
64
<age>18</age>
63
65
<study-field>Computer Engineering</study-field>
64
66
<GPA>4.2</GPA>
65
67
<taken-courses>Julia</taken-courses>
66
68
</person>
67
- """ ))
69
+ """ )
68
70
69
- @test @capture_out (print (U. aml)) == print ( strip ("""
71
+ @test stripall ( @capture_out (pprint (U. aml))) == stripall ("""
70
72
<university university-name="Julia University">
71
73
<person id="1">
72
74
<age>24</age>
82
84
<taken-courses>Julia</taken-courses>
83
85
</person>
84
86
</university>
85
- """ ))
87
+ """ )
86
88
87
- @test @capture_out (print (D . aml)) == print ( strip ("""
89
+ @test stripall ( @capture_out (pprint (D))) == stripall ("""
88
90
<?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">
89
91
<university university-name="Julia University">
90
92
<person id="1">
101
103
<taken-courses>Julia</taken-courses>
102
104
</person>
103
105
</university>
104
- """ ))
106
+ """ )
105
107
106
108
107
109
end
@@ -150,13 +152,13 @@ end
150
152
151
153
P2 = U. people[2 ]
152
154
153
- @test @capture_out (print (P2. aml)) == print ( strip ("""
155
+ @test stripall ( @capture_out (pprint (P2))) == stripall ("""
154
156
<person id="2">
155
157
<age>18</age>
156
158
<study-field>Computer Engineering</study-field>
157
159
<GPA>4</GPA>
158
160
<taken-courses>Julia</taken-courses>
159
161
</person>
160
- """ ))
162
+ """ )
161
163
162
164
end
0 commit comments