mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix bugz
This commit is contained in:
@@ -268,6 +268,7 @@ pub const WalkTask = struct {
|
||||
|
||||
fn deinit(this: *WalkTask) void {
|
||||
this.walker.deinit(true);
|
||||
this.alloc.destroy(this.walker);
|
||||
this.alloc.destroy(this);
|
||||
}
|
||||
};
|
||||
@@ -306,7 +307,9 @@ fn makeGlobWalker(
|
||||
return null;
|
||||
};
|
||||
|
||||
globWalker.* = .{};
|
||||
globWalker.* = .{
|
||||
.allocator = alloc,
|
||||
};
|
||||
|
||||
switch (globWalker.initWithCwd(
|
||||
arena,
|
||||
@@ -334,7 +337,9 @@ fn makeGlobWalker(
|
||||
return null;
|
||||
};
|
||||
|
||||
globWalker.* = .{};
|
||||
globWalker.* = .{
|
||||
.allocator = alloc,
|
||||
};
|
||||
switch (globWalker.init(
|
||||
arena,
|
||||
this.pattern,
|
||||
@@ -463,6 +468,7 @@ pub fn __scanSync(this: *Glob, globalThis: *JSGlobalObject, callframe: *JSC.Call
|
||||
arena.deinit();
|
||||
return .undefined;
|
||||
};
|
||||
defer alloc.destroy(globWalker);
|
||||
defer globWalker.deinit(true);
|
||||
|
||||
switch (globWalker.walk() catch {
|
||||
|
||||
@@ -742,9 +742,13 @@ pub const TestCommand = struct {
|
||||
if (ctx.test_options.include) |include_glob_pattern| {
|
||||
const glob = @import("../glob.zig");
|
||||
const GlobWalker = glob.GlobWalker_(glob.ignoreNodeModules, true);
|
||||
var glob_walker = bun.new(GlobWalker, .{});
|
||||
var arena = std.heap.ArenaAllocator.init(bun.default_allocator);
|
||||
errdefer arena.deinit();
|
||||
var glob_walker = ctx.allocator.create(GlobWalker) catch bun.outOfMemory();
|
||||
glob_walker.* = .{
|
||||
.allocator = ctx.allocator,
|
||||
};
|
||||
defer ctx.allocator.destroy(glob_walker);
|
||||
var arena = std.heap.ArenaAllocator.init(ctx.allocator);
|
||||
defer arena.deinit();
|
||||
|
||||
const result = brk: {
|
||||
const dot: bool = false;
|
||||
@@ -773,13 +777,12 @@ pub const TestCommand = struct {
|
||||
};
|
||||
|
||||
break :brk glob_walker.initWithCwd(&arena, include_glob_pattern, cwd, dot, absolute, follow_symlinks, error_on_broken_symlinks, only_files) catch {
|
||||
arena.deinit();
|
||||
return;
|
||||
};
|
||||
};
|
||||
|
||||
_ = try result.unwrap();
|
||||
defer glob_walker.deinit(true);
|
||||
defer glob_walker.deinit(false);
|
||||
|
||||
var iter = GlobWalker.Iterator{ .walker = glob_walker };
|
||||
defer iter.deinit();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { describe, test, expect } from "bun:test";
|
||||
import { bunExe, bunEnv } from "harness";
|
||||
|
||||
describe("bun test", () => {
|
||||
test("glob include", () => {
|
||||
test("bun test include", () => {
|
||||
const cwd = createTest([
|
||||
{
|
||||
filename: "hello.lol.js",
|
||||
|
||||
Reference in New Issue
Block a user