-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promote tools/compose to xkbcli-compile-compose #402
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicks, overall LGTM, thanks. @bluetech may have a comment on why the locale handling was implemented like that first though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whot thanks for the review. I fixed the code, but I am not sure where to put the escape utility function.
based on the filename |
865374d
to
881d2ef
Compare
I realized I did not push my changes…
@whot I would prefer to keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, got no focus today so only two comments but I trust you enough that this will be fine.
test/compose.c
Outdated
} | ||
assert(buf[c] == '\0'); | ||
assert(strlen(buf) == c); | ||
assert(is_valid_utf8(buf, c)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated to this series: we should have something like
#define assert_printf(cond, ...) \
if (!(cond)) { \
printf("Assertion failure: __VA_ARGS__); \
assert(cond); \
}
to aid with debugging assertion failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I introduced assert_printf
as you suggested, as well as assert_streq_not_null
. I use them only for the new tests.
881d2ef
to
c56b95e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed reviews comments and added a few comments.
@bluetech could you check my refactoring of locale handling?
test/compose.c
Outdated
} | ||
assert(buf[c] == '\0'); | ||
assert(strlen(buf) == c); | ||
assert(is_valid_utf8(buf, c)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I introduced assert_printf
as you suggested, as well as assert_streq_not_null
. I use them only for the new tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, it would be nice to have xkbcli compile-compose
.
I left a few minor comments, but LGTM (feel free to merge after fixing).
Previously this tool was only used for internal testing and thus not installed. But it is useful for debugging, much like xkbcli-compile-keymap.
`compgen` expect command options list formatted as a newline-separated list. Add a missing newline when concatenating two lists.
Currently the result string is not escaped and may produce invalid results. Fixed by introducing an ad-hoc escape function and relative tests.
c56b95e
to
c516335
Compare
Current options to set the locale are convoluted: - An explicit locale *must* be given, while a sane default would be to use the user environment. - Then there are two options that were useful while testing locale handling: read environment variables or use `setlocale`. But the program has already called: ``` setlocale(LC_ALL, ""); ``` so it turns out the two options lead to the same results. Remove options `--locale-from-env` and `--locale-from-setlocale` and make the locale default to the user environment.
c516335
to
c15df4b
Compare
Fixes #381