Changeset f7456bc for tester.c


Ignore:
Timestamp:
Sep 18, 2010, 3:17:27 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
dc9665a
Parents:
5b68c05
git-author:
David Benjamin <davidben@mit.edu> (07/31/10 19:09:41)
git-committer:
David Benjamin <davidben@mit.edu> (09/18/10 15:17:27)
Message:
Add owl_fmtext_line_number and test.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    re5c9d3de rf7456bc  
    436436  owl_fmtext fm1;
    437437  owl_fmtext fm2;
     438  owl_regex re;
    438439  char *str;
    439440
     
    527528  owl_free(str);
    528529
     530  /* Test owl_fmtext_line_number. */
     531  owl_fmtext_clear(&fm1);
     532  owl_fmtext_append_normal(&fm1, "123\n456\n");
     533  owl_fmtext_append_bold(&fm1, "");
     534  FAIL_UNLESS("lines start at 0", 0 == owl_fmtext_line_number(&fm1, 0));
     535  FAIL_UNLESS("trailing formatting characters part of false line",
     536              2 == owl_fmtext_line_number(&fm1, owl_fmtext_num_bytes(&fm1)));
     537  owl_regex_create_quoted(&re, "456");
     538  FAIL_UNLESS("correctly find second line (line 1)",
     539              1 == owl_fmtext_line_number(&fm1, owl_fmtext_search(&fm1, &re, 0)));
     540  owl_regex_cleanup(&re);
     541
    529542  owl_fmtext_cleanup(&fm1);
    530543  owl_fmtext_cleanup(&fm2);
Note: See TracChangeset for help on using the changeset viewer.