Skip to content

Commit

Permalink
Allow to specify a failure reason in xfail
Browse files Browse the repository at this point in the history
You can now specify a reason in xfail. Basically any scalar value except
'false' or 'off' is interpreted as true.
  • Loading branch information
egli committed Sep 11, 2015
1 parent 137167c commit 81d8867
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
13 changes: 11 additions & 2 deletions doc/liblouis.texi
Expand Up @@ -2039,8 +2039,17 @@ The valid additional options for a test are as follows:

@table @samp
@item xfail
Whether a test is expected to fail. Valid options are @samp{true},
@samp{Y}, @samp{Yes} or @samp{ON}. Anything else is considered false.
Whether a test is expected to fail. If you expect a test to fail, set
this to @samp{true}. If you prefer you can also specifiy a reason for
the failure:

@example
- [Hello, ⠨, @{xfail: Testcase is not complete@}]
@end example

If you expect a test case to pass then just don't mark it with
@samp{xfail} or if you really have to, set @samp{xfail} to
@samp{false} or @samp{off}.

@item typeform
The typeform used for a translation. The typeform is passed in the
Expand Down
11 changes: 5 additions & 6 deletions tests/check_yaml.c
Expand Up @@ -120,15 +120,14 @@ read_flags (yaml_parser_t *parser, int *direction, int *hyphenation) {
int
read_xfail (yaml_parser_t *parser) {
yaml_event_t event;
int xfail = 0;
/* assume xfail true if there is an xfail key */
int xfail = 1;
if (!yaml_parser_parse(parser, &event) ||
(event.type != YAML_SCALAR_EVENT))
yaml_error(YAML_SCALAR_EVENT, &event);
if (!strcmp(event.data.scalar.value, "Y") ||
!strcmp(event.data.scalar.value, "true") ||
!strcmp(event.data.scalar.value, "Yes") ||
!strcmp(event.data.scalar.value, "ON"))
xfail = 1;
if (!strcmp(event.data.scalar.value, "false") ||
!strcmp(event.data.scalar.value, "off"))
xfail = 0;
yaml_event_delete(&event);
return xfail;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/en-GB-g2_harness.yaml
Expand Up @@ -225,7 +225,7 @@ tests:
# FIXME: the original json based test only specified one cursor
# position to be tested. Since I don't know the expected result
# I'm setting this test to xfail
xfail: true
xfail: Test incomplete
- # An example to reproduce:
# https://bugzilla.gnome.org/show_bug.cgi?id=651217 note that the
# braille cursor is very squeued. computer cursor is at pos 13,
Expand All @@ -237,7 +237,7 @@ tests:
# FIXME: the original json based test only specified one cursor
# position to be tested. Since I don't know the expected result
# I'm setting this test to xfail
xfail: true
xfail: Test incomplete
- # this testcase tests cursor position when mode is 0. The word
# about is contracted to ab. The user presses cursor routing 1 on
# their display, which should land on letter b, but instead it
Expand Down

0 comments on commit 81d8867

Please sign in to comment.