Fixed StringSubstring() case where the result is one character returns NULL#279
Conversation
|
There was an error running your pipeline, see logs for details. |
| static void test_substring_result_is_one_char(void) | ||
| { | ||
| char *new_string = StringSubstring("[1]", 3, 1, -1); | ||
| assert_string_equal(new_string, "1"); | ||
| free(new_string); | ||
| } | ||
|
|
There was a problem hiding this comment.
Cool, but let's maybe add a few more tests to be sure? I.e. what happens when the 1 char string is at the beginning or end? What happens when the input string is also 1 character? What about when the input or the result is 0 length?
cbc0ddb to
5f2010b
Compare
|
There was an error syncing branches, see logs for details. |
|
There was an error running your pipeline, see logs for details. |
47df656 to
3027897
Compare
|
There was an error running your pipeline, see logs for details. |
…eturned Test cases added. Ticket: none Changelog: none
…g for non-portable VLA usage variable lengh arrays are supported in C99 and optional in C11 but can cause portability issues, so prefer to use alloca() to allocate on the stack frame which is automatically freed when the function returns. Was breaking macos unit test workflow. Ticket: none Changelog: none
3027897 to
01977fb
Compare
|
There was an error running your pipeline, see logs for details. |
1 similar comment
|
There was an error running your pipeline, see logs for details. |
b9b74ad to
7669c0b
Compare
|
There was an error running your pipeline, see logs for details. |
…to return NULL, now returns empty string which aligns e.g. with python array[1:-5] results
7669c0b to
8cbd0db
Compare
|
There was an error running your pipeline, see logs for details. |
|
@cf-bottom jenkins, please |
|
Sure, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/13997/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-13997/ |
Ticket: none
Changelog: none