Changes
3 changed files (+35/-4)
-
-
@@ -33,7 +33,7 @@ function_list: c.OnOff = c.ONOFF_OFF,function_poll: c.OnOff = c.ONOFF_OFF, function_wait: c.OnOff = c.ONOFF_OFF, utc: c.OnOff = c.ONOFF_OFF, debug: c.OnOff = c.ONOFF_OFF, debug: bool = false, report_sunrise: c.OnOff = c.ONOFF_OFF, report_sunset: c.OnOff = c.ONOFF_OFF, list_days: c_uint = c.DEFAULT_LIST,
-
@@ -65,7 +65,7 @@ .functionList = self.function_list,.functionPoll = self.function_poll, .functionWait = self.function_wait, .utc = self.utc, .debug = self.debug, .debug = if (self.debug) c.ONOFF_ON else c.ONOFF_OFF, .reportSunrise = self.report_sunrise, .reportSunset = self.report_sunset, .listDays = self.list_days,
-
-
-
@@ -46,6 +46,8 @@ \\\\[Options] \\-v, --version Prints version to stdout and exits. \\-h, --help Prints this message to stdout and exits. \\--debug Prints debug log, and shortens "wait" duration \\ to one minute. \\ \\[Commands] \\poll Prints whether it's DAY or NIGHT.
-
@@ -80,8 +82,7 @@ defer arena.deinit();const allocator = arena.allocator(); const opts = RunOptions.init(); var c_opts = opts.toC(); var opts = RunOptions.init(); var args = std.process.ArgIterator.initWithAllocator(allocator) catch { return ExitCode.out_of_memory.code();
-
@@ -111,7 +112,14 @@ };return ExitCode.ok.code(); } if (std.mem.eql(u8, "--debug", arg)) { opts.debug = true; continue; } } var c_opts = opts.toC(); return switch (c.sunpoll(&c_opts)) { c.EXIT_DAY => ExitCode.day.code(),
-
-
-
@@ -47,3 +47,26 @@ // try std.testing.expectEqual(legacy.term.Exited, new.term.Exited);// try std.testing.expectEqualStrings(legacy.stderr, new.stderr); // try std.testing.expectEqualStrings(legacy.stdout, new.stdout); } test { const regular = try poll(std.testing.allocator, config.new_bin); defer std.testing.allocator.free(regular.stderr); defer std.testing.allocator.free(regular.stdout); var env = std.process.EnvMap.init(std.testing.allocator); defer env.deinit(); try env.put("TZ", "UTC"); const debug = try std.process.Child.run(.{ .allocator = std.testing.allocator, .argv = &.{ config.new_bin, "--debug", "poll", "29.977435N", "31.132484E" }, .env_map = &env, }); defer std.testing.allocator.free(debug.stderr); defer std.testing.allocator.free(debug.stdout); // Original sunwait prints debug log to stdout. // TODO: Print to stderr try std.testing.expect(debug.stdout.len > regular.stdout.len); }
-