Просмотр исходного кода

build: show the logo in named mode

When running `zig build -Dn=n`, ensure that the logo is printed.

Update the tests.

Closes #214
Manlio Perillo 2 лет назад
Родитель
Сommit
0304dc3d37
2 измененных файлов с 13 добавлено и 0 удалено
  1. 3 0
      build.zig
  2. 10 0
      test/tests.zig

+ 3 - 0
build.zig

@@ -153,8 +153,11 @@ pub fn build(b: *Build) !void {
             b.fmt("Check the solution of {s}", .{ex.main_file}),
             b.fmt("Check the solution of {s}", .{ex.main_file}),
         );
         );
         b.default_step = zigling_step;
         b.default_step = zigling_step;
+        zigling_step.dependOn(&header_step.step);
 
 
         const verify_step = ZiglingStep.create(b, ex, work_path);
         const verify_step = ZiglingStep.create(b, ex, work_path);
+        verify_step.step.dependOn(&header_step.step);
+
         zigling_step.dependOn(&verify_step.step);
         zigling_step.dependOn(&verify_step.step);
 
 
         return;
         return;

+ 10 - 0
test/tests.zig

@@ -151,6 +151,16 @@ const CheckNamedStep = struct {
         defer stderr_file.close();
         defer stderr_file.close();
 
 
         const stderr = stderr_file.reader();
         const stderr = stderr_file.reader();
+        {
+            // Skip the logo.
+            const nlines = mem.count(u8, root.logo, "\n");
+            var buf: [80]u8 = undefined;
+
+            var lineno: usize = 0;
+            while (lineno < nlines) : (lineno += 1) {
+                _ = try readLine(stderr, &buf);
+            }
+        }
         try check_output(step, ex, stderr);
         try check_output(step, ex, stderr);
     }
     }
 };
 };