mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-07-28 18:25:16 +00:00
Compare commits
6 Commits
a5ed7b636b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f39b462659 | |||
| a2eee9d52f | |||
| 248093a2de | |||
| 004ea3b3ae | |||
| c85daab1a1 | |||
| f6c3e4edc4 |
@@ -36,5 +36,5 @@ pub fn main(init: std.process.Init) !void {
|
||||
// 'std.debug.print()' prints its output to stderr, while the stdout_writer
|
||||
// approach prints to stdout.
|
||||
// A common practice is to pipe output of a command to other commands,
|
||||
// and in order for the piping to work, those commands expect thier input
|
||||
// and in order for the piping to work, those commands expect their input
|
||||
// to come from stdout, not stderr.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--- exercises/036_enums2.zig 2023-10-03 22:15:22.122241138 +0200
|
||||
+++ answers/036_enums2.zig 2023-10-05 20:04:07.002765884 +0200
|
||||
--- exercises/036_enums2.zig 2026-07-21 20:48:50.596099259 +0200
|
||||
+++ answers/036_enums2.zig 2026-07-21 20:50:14.726826859 +0200
|
||||
@@ -31,7 +31,7 @@
|
||||
const Color = enum(u32) {
|
||||
red = 0xff0000,
|
||||
@@ -18,9 +18,11 @@
|
||||
\\</p>
|
||||
\\
|
||||
, .{
|
||||
@intFromEnum(Color.red),
|
||||
@intFromEnum(Color.green),
|
||||
- @intFromEnum(Color.red),
|
||||
- @intFromEnum(Color.green),
|
||||
- @intFromEnum(???), // Oops! We're missing something!
|
||||
+ @intFromEnum(Color.blue), // Oops! We're missing something!
|
||||
+ @backingInt(Color.red),
|
||||
+ @backingInt(Color.green),
|
||||
+ @backingInt(Color.blue), // Oops! We're missing something!
|
||||
});
|
||||
}
|
||||
|
||||
@@ -359,7 +359,6 @@ fn runExe(ctx: Context, ex: Exercise) !void {
|
||||
return err;
|
||||
};
|
||||
|
||||
resetLine();
|
||||
print("Checking {s}...\n", .{ex.main_file});
|
||||
|
||||
return checkOutput(io, arena, ex, result);
|
||||
@@ -392,7 +391,6 @@ fn runTest(ctx: Context, ex: Exercise) !void {
|
||||
return err;
|
||||
};
|
||||
|
||||
resetLine();
|
||||
print("Checking {s}...\n", .{ex.main_file});
|
||||
|
||||
return checkTest(ex, result);
|
||||
@@ -486,10 +484,6 @@ fn help(ex: Exercise, mode: Mode) void {
|
||||
});
|
||||
}
|
||||
|
||||
fn resetLine() void {
|
||||
if (stderr_term_mode == .escape_codes) print("{s}", .{"\x1b[2K\r"});
|
||||
}
|
||||
|
||||
// Removes trailing whitespace per line and any trailing LF at the end.
|
||||
fn trimLines(arena: std.mem.Allocator, buf: []const u8) ![]const u8 {
|
||||
var list = try std.ArrayList(u8).initCapacity(arena, buf.len);
|
||||
|
||||
Reference in New Issue
Block a user