Skip to content

Commit 8c3939b

Browse files
committed
wpt: remove useless Suite.stack
1 parent b537e52 commit 8c3939b

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

src/main_wpt.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub fn main() !void {
142142
defer arena.deinit();
143143

144144
const res = wpt.run(&arena, wpt_dir, tc, &loader) catch |err| {
145-
const suite = try Suite.init(alloc, tc, false, @errorName(err), null);
145+
const suite = try Suite.init(alloc, tc, false, @errorName(err));
146146
try results.append(suite);
147147

148148
if (out == .text) {
@@ -153,7 +153,7 @@ pub fn main() !void {
153153
};
154154
defer res.deinit(arena.allocator());
155155

156-
const suite = try Suite.init(alloc, tc, res.ok, res.msg orelse "", null);
156+
const suite = try Suite.init(alloc, tc, res.ok, res.msg orelse "");
157157
try results.append(suite);
158158

159159
if (out == .json) {
@@ -196,7 +196,7 @@ pub fn main() !void {
196196
try cases.append(Case{
197197
.pass = suite.pass,
198198
.name = suite.name,
199-
.message = suite.stack orelse suite.message,
199+
.message = suite.message,
200200
});
201201
}
202202

src/wpt/testcase.zig

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,28 +67,22 @@ pub const Suite = struct {
6767
pass: bool,
6868
name: []const u8,
6969
message: ?[]const u8,
70-
stack: ?[]const u8,
7170
cases: ?[]Case,
7271

7372
// caller owns the wpt.Suite.
7473
// owner must call deinit().
75-
pub fn init(alloc: std.mem.Allocator, name: []const u8, pass: bool, res: []const u8, stack: ?[]const u8) !Suite {
74+
pub fn init(alloc: std.mem.Allocator, name: []const u8, pass: bool, res: []const u8) !Suite {
7675
var suite = Suite{
7776
.alloc = alloc,
7877
.pass = false,
7978
.name = try alloc.dupe(u8, name),
8079
.message = null,
81-
.stack = null,
8280
.cases = null,
8381
};
8482

8583
// handle JS error.
8684
if (!pass) {
8785
suite.message = try alloc.dupe(u8, res);
88-
if (stack) |st| {
89-
suite.stack = try alloc.dupe(u8, st);
90-
}
91-
9286
return suite;
9387
}
9488

@@ -155,10 +149,6 @@ pub const Suite = struct {
155149
pub fn deinit(self: Suite) void {
156150
self.alloc.free(self.name);
157151

158-
if (self.stack) |stack| {
159-
self.alloc.free(stack);
160-
}
161-
162152
if (self.message) |res| {
163153
self.alloc.free(res);
164154
}
@@ -175,9 +165,6 @@ pub const Suite = struct {
175165
if (self.message) |v| {
176166
return v;
177167
}
178-
if (self.stack) |v| {
179-
return v;
180-
}
181168
return "";
182169
}
183170
};
@@ -199,7 +186,7 @@ test "success test case" {
199186
,
200187
};
201188

202-
const suite = Suite.init(alloc, "foo", res.pass, res.result, null) catch unreachable; // TODO
189+
const suite = Suite.init(alloc, "foo", res.pass, res.result) catch unreachable; // TODO
203190
defer suite.deinit();
204191

205192
try testing.expect(suite.pass == true);
@@ -226,7 +213,7 @@ test "failed test case" {
226213
,
227214
};
228215

229-
const suite = Suite.init(alloc, "foo", res.pass, res.result, null) catch unreachable; // TODO
216+
const suite = Suite.init(alloc, "foo", res.pass, res.result) catch unreachable; // TODO
230217
defer suite.deinit();
231218

232219
try testing.expect(suite.pass == false);
@@ -251,7 +238,7 @@ test "invalid result" {
251238
,
252239
};
253240

254-
const suite = Suite.init(alloc, "foo", res.pass, res.result, null) catch unreachable; // TODO
241+
const suite = Suite.init(alloc, "foo", res.pass, res.result) catch unreachable; // TODO
255242
defer suite.deinit();
256243

257244
try testing.expect(suite.pass == false);
@@ -266,7 +253,7 @@ test "invalid result" {
266253
,
267254
};
268255

269-
const suite2 = Suite.init(alloc, "foo", res2.pass, res2.result, null) catch unreachable; // TODO
256+
const suite2 = Suite.init(alloc, "foo", res2.pass, res2.result) catch unreachable; // TODO
270257
defer suite2.deinit();
271258

272259
try testing.expect(suite2.pass == false);

0 commit comments

Comments
 (0)