| ... | @@ -183,6 +183,8 @@ pub fn formatValue(value: var, context: var, output: fn(@typeOf(context), []cons | ... | @@ -183,6 +183,8 @@ pub fn formatValue(value: var, context: var, output: fn(@typeOf(context), []cons |
| 183 | return output(context, casted_value); | 183 | return output(context, casted_value); |
| 184 | } else if (T == void) { | 184 | } else if (T == void) { |
| 185 | return output(context, "void"); | 185 | return output(context, "void"); |
| | 186 | } else if (T == bool) { |
| | 187 | return output(context, if (value) "true" else "false"); |
| 186 | } else { | 188 | } else { |
| 187 | @compileError("Unable to format type '" ++ @typeName(T) ++ "'"); | 189 | @compileError("Unable to format type '" ++ @typeName(T) ++ "'"); |
| 188 | } | 190 | } |
| ... | @@ -363,7 +365,7 @@ fn countSize(size: &usize, bytes: []const u8) -> bool { | ... | @@ -363,7 +365,7 @@ fn countSize(size: &usize, bytes: []const u8) -> bool { |
| 363 | return true; | 365 | return true; |
| 364 | } | 366 | } |
| 365 | | 367 | |
| 366 | test "testBufPrintInt" { | 368 | test "buf print int" { |
| 367 | var buffer: [max_int_digits]u8 = undefined; | 369 | var buffer: [max_int_digits]u8 = undefined; |
| 368 | const buf = buffer[0...]; | 370 | const buf = buffer[0...]; |
| 369 | assert(mem.eql(u8, bufPrintIntToSlice(buf, i32(-12345678), 2, false, 0), "-101111000110000101001110")); | 371 | assert(mem.eql(u8, bufPrintIntToSlice(buf, i32(-12345678), 2, false, 0), "-101111000110000101001110")); |
| ... | @@ -385,7 +387,7 @@ fn bufPrintIntToSlice(buf: []u8, value: var, base: u8, uppercase: bool, width: u | ... | @@ -385,7 +387,7 @@ fn bufPrintIntToSlice(buf: []u8, value: var, base: u8, uppercase: bool, width: u |
| 385 | return buf[0...formatIntBuf(buf, value, base, uppercase, width)]; | 387 | return buf[0...formatIntBuf(buf, value, base, uppercase, width)]; |
| 386 | } | 388 | } |
| 387 | | 389 | |
| 388 | test "testParseU64DigitTooBig" { | 390 | test "parse u64 digit too big" { |
| 389 | _ = parseUnsigned(u64, "123a", 10) %% |err| { | 391 | _ = parseUnsigned(u64, "123a", 10) %% |err| { |
| 390 | if (err == error.InvalidChar) return; | 392 | if (err == error.InvalidChar) return; |
| 391 | unreachable; | 393 | unreachable; |
| ... | @@ -393,7 +395,7 @@ test "testParseU64DigitTooBig" { | ... | @@ -393,7 +395,7 @@ test "testParseU64DigitTooBig" { |
| 393 | unreachable; | 395 | unreachable; |
| 394 | } | 396 | } |
| 395 | | 397 | |
| 396 | test "testParseUnsignedComptime" { | 398 | test "parse unsigned comptime" { |
| 397 | comptime { | 399 | comptime { |
| 398 | assert(%%parseUnsigned(usize, "2", 10) == 2); | 400 | assert(%%parseUnsigned(usize, "2", 10) == 2); |
| 399 | } | 401 | } |