mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-03-28 21:34:52 +00:00
Added field .skip_hint to show information on why a file has been
skipped.
This commit is contained in:
parent
e6d93d731a
commit
2b5a603c43
20
build.zig
20
build.zig
|
|
@ -72,6 +72,9 @@ pub const Exercise = struct {
|
|||
/// This exercise is not supported by the current Zig compiler.
|
||||
skip: bool = false,
|
||||
|
||||
/// Hint to the user, why this has been skipped
|
||||
skip_hint: ?[]const u8 = null,
|
||||
|
||||
/// Returns the name of the main file with .zig stripped.
|
||||
pub fn name(self: Exercise) []const u8 {
|
||||
return std.fs.path.stem(self.main_file);
|
||||
|
|
@ -347,8 +350,12 @@ const ZiglingStep = struct {
|
|||
const self: *ZiglingStep = @alignCast(@fieldParentPtr("step", step));
|
||||
|
||||
if (self.exercise.skip) {
|
||||
print("Skipping {s}\n\n", .{self.exercise.main_file});
|
||||
print("Skipping {s}", .{self.exercise.main_file});
|
||||
|
||||
if (self.exercise.skip_hint) |hint|
|
||||
print("\n{s}Reason: {s}{s}\n", .{ bold_text, hint, reset_text });
|
||||
|
||||
print( "\n\n", .{});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1038,7 +1045,8 @@ const exercises = [_]Exercise{
|
|||
.{
|
||||
.main_file = "074_comptime9.zig",
|
||||
.output = "My llama value is 2.",
|
||||
.skip = true,
|
||||
.skip = false,
|
||||
.skip_hint = "This is actually correct as it is. :-)"
|
||||
},
|
||||
.{
|
||||
.main_file = "075_quiz8.zig",
|
||||
|
|
@ -1089,41 +1097,49 @@ const exercises = [_]Exercise{
|
|||
.output = "foo() A",
|
||||
.hint = "Read the facts. Use the facts.",
|
||||
.skip = true,
|
||||
.skip_hint = "async has not been implemented in the current compiler version.",
|
||||
},
|
||||
.{
|
||||
.main_file = "085_async2.zig",
|
||||
.output = "Hello async!",
|
||||
.skip = true,
|
||||
.skip_hint = "async has not been implemented in the current compiler version.",
|
||||
},
|
||||
.{
|
||||
.main_file = "086_async3.zig",
|
||||
.output = "5 4 3 2 1",
|
||||
.skip = true,
|
||||
.skip_hint = "async has not been implemented in the current compiler version.",
|
||||
},
|
||||
.{
|
||||
.main_file = "087_async4.zig",
|
||||
.output = "1 2 3 4 5",
|
||||
.skip = true,
|
||||
.skip_hint = "async has not been implemented in the current compiler version.",
|
||||
},
|
||||
.{
|
||||
.main_file = "088_async5.zig",
|
||||
.output = "Example Title.",
|
||||
.skip = true,
|
||||
.skip_hint = "async has not been implemented in the current compiler version.",
|
||||
},
|
||||
.{
|
||||
.main_file = "089_async6.zig",
|
||||
.output = ".com: Example Title, .org: Example Title.",
|
||||
.skip = true,
|
||||
.skip_hint = "async has not been implemented in the current compiler version.",
|
||||
},
|
||||
.{
|
||||
.main_file = "090_async7.zig",
|
||||
.output = "beef? BEEF!",
|
||||
.skip = true,
|
||||
.skip_hint = "async has not been implemented in the current compiler version.",
|
||||
},
|
||||
.{
|
||||
.main_file = "091_async8.zig",
|
||||
.output = "ABCDEF",
|
||||
.skip = true,
|
||||
.skip_hint = "async has not been implemented in the current compiler version.",
|
||||
},
|
||||
|
||||
.{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user