[U-Boot] test: print_ut: Add test for %ls strings

Message ID 20170913224657.23321-1-robdclark@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show
Series
  • [U-Boot] test: print_ut: Add test for %ls strings
Related show

Commit Message

Rob Clark Sept. 13, 2017, 10:46 p.m.
Add a simple test for long strings.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 test/print_ut.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass Sept. 17, 2017, 5:54 p.m. | #1
On 13 September 2017 at 16:46, Rob Clark <robdclark@gmail.com> wrote:
> Add a simple test for long strings.
>
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
>  test/print_ut.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Sept. 29, 2017, 9 p.m. | #2
On 13 September 2017 at 16:46, Rob Clark <robdclark@gmail.com> wrote:
> Add a simple test for long strings.
>
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
>  test/print_ut.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm thanks!

Patch

diff --git a/test/print_ut.c b/test/print_ut.c
index baad289972..a42c554bef 100644
--- a/test/print_ut.c
+++ b/test/print_ut.c
@@ -36,6 +36,9 @@  static int do_ut_print(cmd_tbl_t *cmdtp, int flag, int argc,
 	snprintf(str, 0, "testing none");
 	assert(*str == 'x');
 
+	sprintf(big_str, "_%ls_", L"foo");
+	assert(!strcmp("_foo_", big_str));
+
 	/* Test the banner function */
 	s = display_options_get_banner(true, str, sizeof(str));
 	assert(s == str);