Skip to content

Conversation

@m0tholith
Copy link
Contributor

No description provided.

@m0tholith m0tholith force-pushed the add_test_log_level_option branch from 01d2aa7 to b9822e5 Compare November 7, 2025 12:21
@m0tholith
Copy link
Contributor Author

Made argument passed to --test-log-level case-insensitive (so: debug, Debug, DEBUG all work). Also made error messages more helpful.

@m0tholith
Copy link
Contributor Author

(bump @lerno)

options->test_filter = next_arg();
return;
}
if (match_longopt("test-log-level"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use match_argopt with the different options here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see from the other examples how it works.

io::printn("Missing log level for argument `--test-log-level`.");
return false;
}
args[i + 1].convert_to_lower();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you convert it to upper case instead, you can use enum_by_name(LogPriority, args[i + 1]) and drop the switch.

case "critical": context.log_level = LogPriority.CRITICAL;
default:
io::print("Log level given to `--test-log-level` is not one of: ");
$foreach $level : LogPriority.names[:^1]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since LogPriority will not change, just write this as a hard coded description rather than grabbing the names.

@lerno
Copy link
Collaborator

lerno commented Nov 11, 2025

I'll look at this on Friday. Remind me if I forget.

@lerno lerno merged commit 60cdea5 into c3lang:master Nov 20, 2025
45 of 47 checks passed
@lerno
Copy link
Collaborator

lerno commented Nov 20, 2025

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants