[2587] in BarnOwl Developers
Re: [PATCH 1/2] Add a test for owl_editwin_move_to_beginning_of_line
daemon@ATHENA.MIT.EDU (Nelson Elhage)
Sat Aug 7 16:52:57 2010
From: Nelson Elhage <nelhage@MIT.EDU>
To: David Benjamin <davidben@mit.edu>, barnowl-dev@mit.edu
In-Reply-To: <1281156970-17962-1-git-send-email-davidben@mit.edu>
Date: Sat, 07 Aug 2010 16:52:53 -0400
Both patches
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
On Fri, 6 Aug 2010 21:56:09 -0700, David Benjamin <davidben@MIT.EDU> wrote:
> We currently incorrectly handle buffers which begin with an empty line.
> ---
> tester.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/tester.c b/tester.c
> index 7325ec0..deb4384 100644
> --- a/tester.c
> +++ b/tester.c
> @@ -404,6 +404,28 @@ int owl_editwin_regtest(void) {
>
> owl_editwin_delete(oe); oe = NULL;
>
> + /* Test owl_editwin_move_to_beginning_of_line. */
> + oe = owl_editwin_new(NULL, 80, 80, OWL_EDITWIN_STYLE_MULTILINE, NULL);
> + owl_editwin_insert_string(oe, "\n");
> + owl_editwin_insert_string(oe, "12345678\n");
> + owl_editwin_insert_string(oe, "\n");
> + owl_editwin_insert_string(oe, "abcdefg\n");
> + owl_editwin_move_to_top(oe);
> + FAIL_UNLESS("already at beginning of line",
> + owl_editwin_move_to_beginning_of_line(oe) == 0);
> + owl_editwin_line_move(oe, 1);
> + owl_editwin_point_move(oe, 5);
> + FAIL_UNLESS("find beginning of line after empty first line",
> + owl_editwin_move_to_beginning_of_line(oe) == -5);
> + owl_editwin_line_move(oe, 1);
> + FAIL_UNLESS("find beginning empty middle line",
> + owl_editwin_move_to_beginning_of_line(oe) == 0);
> + owl_editwin_line_move(oe, 1);
> + owl_editwin_point_move(oe, 2);
> + FAIL_UNLESS("find beginning of line after empty middle line",
> + owl_editwin_move_to_beginning_of_line(oe) == -2);
> + owl_editwin_delete(oe); oe = NULL;
> +
> printf("# END testing owl_editwin (%d failures)\n", numfailed);
>
> return numfailed;
> --
> 1.7.2.1.7.gf50fd
>
>