Skip to content
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

tests: add tests on g_strtrim() #2015

Merged
merged 2 commits into from Oct 12, 2021
Merged

Conversation

metalefty
Copy link
Member

I was just learning how to write tests using libcheck. Just to share the output.

Copy link
Member

@matt335672 matt335672 left a comment

Choose a reason for hiding this comment

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

Looks good. Minor comment.

{
/* setup */
const char *input = "\t\t \tDone is better than perfect.\t\t \n\n";
char *output = g_strdup(input);
Copy link
Member

Choose a reason for hiding this comment

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

Can avoid the string copy by replacing

    const char *input = "\t\t    \tDone is better than perfect.\t\t    \n\n";
    char *output = g_strdup(input);

with:-

char output[] = "\t\t    \tDone is better than perfect.\t\t    \n\n";

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed!

@matt335672 matt335672 merged commit 729aaad into neutrinolabs:devel Oct 12, 2021
@metalefty metalefty deleted the test-strtrim branch October 12, 2021 09:29
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.

None yet

2 participants