| ... | ... | @@ -4,6 +4,7 @@ const build = std.build; |
| 4 | 4 | const fs = std.fs; |
| 5 | 5 | const macho = std.macho; |
| 6 | 6 | const mem = std.mem; |
| 7 | const testing = std.testing; |
| 7 | 8 | |
| 8 | 9 | const CheckObjectStep = @This(); |
| 9 | 10 | |
| ... | ... | @@ -179,13 +180,16 @@ fn make(step: *Step) !void { |
| 179 | 180 | switch (act) { |
| 180 | 181 | .match => |match_act| { |
| 181 | 182 | while (it.next()) |line| { |
| 182 | | if (try match_act.match(line, &vars)) { |
| 183 | | std.debug.print("{s} == {s}\n", .{ line, match_act.needle }); |
| 184 | | break; |
| 185 | | } else { |
| 186 | | std.debug.print("{s} != {s}\n", .{ line, match_act.needle }); |
| 187 | | } |
| 183 | if (try match_act.match(line, &vars)) break; |
| 188 | 184 | } else { |
| 185 | std.debug.print( |
| 186 | \\ |
| 187 | \\========= Expected to find: ========================== |
| 188 | \\{s} |
| 189 | \\========= But parsed file does not contain it: ======= |
| 190 | \\{s} |
| 191 | \\ |
| 192 | , .{ match_act.needle, output }); |
| 189 | 193 | return error.TestFailed; |
| 190 | 194 | } |
| 191 | 195 | }, |
| ... | ... | @@ -193,7 +197,17 @@ fn make(step: *Step) !void { |
| 193 | 197 | var values = std.ArrayList(u64).init(gpa); |
| 194 | 198 | try values.ensureTotalCapacity(c_eq.var_stack.items.len); |
| 195 | 199 | for (c_eq.var_stack.items) |vv| { |
| 196 | | const val = vars.get(vv) orelse return error.TestFailed; |
| 200 | const val = vars.get(vv) orelse { |
| 201 | std.debug.print( |
| 202 | \\ |
| 203 | \\========= Variable was not extracted: =========== |
| 204 | \\{s} |
| 205 | \\========= From parsed file: ===================== |
| 206 | \\{s} |
| 207 | \\ |
| 208 | , .{ vv, output }); |
| 209 | return error.TestFailed; |
| 210 | }; |
| 197 | 211 | values.appendAssumeCapacity(val); |
| 198 | 212 | } |
| 199 | 213 | |
| ... | ... | @@ -208,17 +222,22 @@ fn make(step: *Step) !void { |
| 208 | 222 | } |
| 209 | 223 | } |
| 210 | 224 | |
| 211 | | const expected = vars.get(c_eq.expected) orelse return error.TestFailed; |
| 212 | | if (reduced != expected) return error.TestFailed; |
| 225 | const expected = vars.get(c_eq.expected) orelse { |
| 226 | std.debug.print( |
| 227 | \\ |
| 228 | \\========= Variable was not extracted: =========== |
| 229 | \\{s} |
| 230 | \\========= From parsed file: ===================== |
| 231 | \\{s} |
| 232 | \\ |
| 233 | , .{ c_eq.expected, output }); |
| 234 | return error.TestFailed; |
| 235 | }; |
| 236 | try testing.expectEqual(reduced, expected); |
| 213 | 237 | }, |
| 214 | 238 | } |
| 215 | 239 | } |
| 216 | 240 | } |
| 217 | | |
| 218 | | var it = vars.iterator(); |
| 219 | | while (it.next()) |entry| { |
| 220 | | std.debug.print(" {s} => {x}\n", .{ entry.key_ptr.*, entry.value_ptr.* }); |
| 221 | | } |
| 222 | 241 | } |
| 223 | 242 | |
| 224 | 243 | const Opts = struct { |