@@ -138,21 +138,51 @@ local ImpTestCase = class {
138
138
throw " Possible cyclic reference at " + cleanPath (path);
139
139
}
140
140
141
+ if (typeof value1 != typeof value2) {
142
+ throw format (" Values are not the same type, typeof lhs = %s, typeof rhs = %s" , typeof value1, typeof value2)
143
+ }
144
+
141
145
switch (type (value1)) {
142
146
case " table" :
143
147
case " class" :
144
148
case " array" :
145
149
146
150
foreach (k, v in value1) {
147
- path += " ." + k;
151
+ local extendedPath = path + " ." + k;
148
152
149
153
if (! (k in value2)) {
150
- throw format (message, cleanPath (path ),
154
+ throw format (message, cleanPath (extendedPath ),
151
155
isForwardPass ? v + " " : " none" ,
152
156
isForwardPass ? " none" : v + " " );
153
157
}
154
158
155
- this . _assertDeepEqual (value1[k], value2[k], message, isForwardPass, path, level + 1 );
159
+ this . _assertDeepEqual (value1[k], value2[k], message, isForwardPass, extendedPath, level + 1 );
160
+ }
161
+
162
+ break ;
163
+
164
+ case " meta" :
165
+
166
+ switch (typeof value1) {
167
+ case " blob" :
168
+
169
+ if (value1. len () != value2. len ()) {
170
+ throw format (" Blob lengths unequal, lhs.len() == %d, rhs.len() == %d" , value1. len (), value2. len ());
171
+ }
172
+
173
+ if (crypto. equals (value1, value2) == false ) {
174
+ throw format (" Blobs are the same length (%d bytes), but the contents are not identical." , value1. len ());
175
+ }
176
+
177
+ break ;
178
+
179
+ default :
180
+
181
+ if (value2 != value1) {
182
+ throw format (message, cleanPath (path), value1 + " " , value2 + " " );
183
+ }
184
+
185
+ break ;
156
186
}
157
187
158
188
break ;
0 commit comments