diff options
author | 2023-01-24 23:54:42 -0800 | |
---|---|---|
committer | 2023-01-24 23:54:42 -0800 | |
commit | 81b6878e1a96487b4ae9020eb9f53bce0b2995c6 (patch) | |
tree | 866784fded7b660c97b8fd1a5c515dfe51e22b2f | |
parent | 325ffd70e17992e9b61c41e854e9e0a810f21274 (diff) | |
download | bun-81b6878e1a96487b4ae9020eb9f53bce0b2995c6.tar.gz bun-81b6878e1a96487b4ae9020eb9f53bce0b2995c6.tar.zst bun-81b6878e1a96487b4ae9020eb9f53bce0b2995c6.zip |
Add assertion
-rw-r--r-- | src/install/npm.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/install/npm.zig b/src/install/npm.zig index a1be4c75c..3301b2653 100644 --- a/src/install/npm.zig +++ b/src/install/npm.zig @@ -1113,12 +1113,30 @@ pub const PackageManifest = struct { group_slice[group_i] = string_builder.append(ExternalString, bin_prop.key.?.asString(allocator) orelse break :bin); if (is_identical) { is_identical = group_slice[group_i].hash == prev_extern_bin_group[group_i].hash; + if (comptime Environment.allow_assert) { + if (is_identical) { + const first = group_slice[group_i].slice(string_builder.allocatedSlice()); + const second = prev_extern_bin_group[group_i].slice(string_builder.allocatedSlice()); + if (!strings.eqlLong(first, second, true)) { + Output.panic("Bin group is not identical: {s} != {s}", .{ first, second }); + } + } + } } group_i += 1; group_slice[group_i] = string_builder.append(ExternalString, bin_prop.value.?.asString(allocator) orelse break :bin); if (is_identical) { is_identical = group_slice[group_i].hash == prev_extern_bin_group[group_i].hash; + if (comptime Environment.allow_assert) { + if (is_identical) { + const first = group_slice[group_i].slice(string_builder.allocatedSlice()); + const second = prev_extern_bin_group[group_i].slice(string_builder.allocatedSlice()); + if (!strings.eqlLong(first, second, true)) { + Output.panic("Bin group is not identical: {s} != {s}", .{ first, second }); + } + } + } } group_i += 1; } |