@@ -236,6 +236,9 @@ pub fn formatType(
|
||||
const casted_value = ([]const u8)(value);
|
||||
return output(context, casted_value);
|
||||
},
|
||||
builtin.TypeInfo.Pointer.Size.C => {
|
||||
return format(context, Errors, output, "{}@{x}", @typeName(T.Child), @ptrToInt(value));
|
||||
},
|
||||
},
|
||||
builtin.TypeId.Array => |info| {
|
||||
if (info.child == u8) {
|
||||
|
||||
@@ -463,13 +463,16 @@ pub fn eql(a: var, b: @typeOf(a)) bool {
|
||||
builtin.TypeId.Pointer => {
|
||||
const info = @typeInfo(T).Pointer;
|
||||
switch (info.size) {
|
||||
builtin.TypeInfo.Pointer.Size.One, builtin.TypeInfo.Pointer.Size.Many => return a == b,
|
||||
builtin.TypeInfo.Pointer.Size.One,
|
||||
builtin.TypeInfo.Pointer.Size.Many,
|
||||
builtin.TypeInfo.Pointer.Size.C,
|
||||
=> return a == b,
|
||||
builtin.TypeInfo.Pointer.Size.Slice => return a.ptr == b.ptr and a.len == b.len,
|
||||
}
|
||||
},
|
||||
builtin.TypeId.Optional => {
|
||||
if(a == null and b == null) return true;
|
||||
if(a == null or b == null) return false;
|
||||
if (a == null and b == null) return true;
|
||||
if (a == null or b == null) return false;
|
||||
return eql(a.?, b.?);
|
||||
},
|
||||
else => return a == b,
|
||||
|
||||
@@ -69,7 +69,7 @@ pub fn expectEqual(expected: var, actual: var) void {
|
||||
}
|
||||
},
|
||||
|
||||
builtin.TypeInfo.Pointer.Size.Slice => {
|
||||
builtin.TypeInfo.Pointer.Size.Slice => {
|
||||
if (actual.ptr != expected.ptr) {
|
||||
std.debug.panic("expected slice ptr {}, found {}", expected.ptr, actual.ptr);
|
||||
}
|
||||
@@ -122,7 +122,6 @@ pub fn expectEqual(expected: var, actual: var) void {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user