JBehave
  1. JBehave
  2. JBEHAVE-371

Allow leading and trailing spaces to be preserved in example table cells

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.3
    • Fix Version/s: 3.1
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      In JBehave Core 3.0.3 all leading and trailing spaces are removed from example table cells.

      For example, when accessed through the ExamplesTable API (the following table

      | |A | B | C|
      | |X | Y | Z|
      

      becomes

      ||A|B|C|
      ||X|Y|Z|
      

      Leading/trailing spaces were not removed for JBehave Core versions older than 3.0.3. So, it might be a regression cause when this http://jira.codehaus.org/browse/JBEHAVE-353 was fixed.

      At least for me it would be nice to be able to use example tables containing cells with leading/trailing spaces.

        Activity

        Hide
        Mauro Talevi added a comment -

        Frank, what's the use case for keeping the spaces?

        Show
        Mauro Talevi added a comment - Frank, what's the use case for keeping the spaces?
        Hide
        Frank Grimm added a comment -

        I'm using JBehave to test an Excel spreadsheet importer (used to import requirements defined in one tool into another). (Unfortunately, ) Users are allowed to have spaces in cells. Since the importer/parser identifies columns based on the name of their header cells, and since some header cells actually have leading/trailing spaces, it would be nice to be able to use the same names in example tables when defining test scenarios.

        I could have a look at the implementation and see whether I could fix it myself. Mauro, any hint where to start looking would be very welcomed

        Thanks,
        Frank

        Show
        Frank Grimm added a comment - I'm using JBehave to test an Excel spreadsheet importer (used to import requirements defined in one tool into another). (Unfortunately, ) Users are allowed to have spaces in cells. Since the importer/parser identifies columns based on the name of their header cells, and since some header cells actually have leading/trailing spaces, it would be nice to be able to use the same names in example tables when defining test scenarios. I could have a look at the implementation and see whether I could fix it myself. Mauro, any hint where to start looking would be very welcomed Thanks, Frank
        Hide
        Mauro Talevi added a comment - - edited

        It's actually trivial to not trim the table cells, but the real point is that most users would find that less useful or annoying to have to trim it themselves. We need to find a way to support multiple parsing modes, whist using the same parser (the ExamplesTable model class).

        Some optional parsing meta info before the table data might do the trick, identified as anything in {} before first header separator. E.g.:

        {trim=false}
        | |A | B | C|
        | |X | Y | Z|
        

        Then we could also add other directives, e.g. for the default sorting of the data.

        Show
        Mauro Talevi added a comment - - edited It's actually trivial to not trim the table cells, but the real point is that most users would find that less useful or annoying to have to trim it themselves. We need to find a way to support multiple parsing modes, whist using the same parser (the ExamplesTable model class). Some optional parsing meta info before the table data might do the trick, identified as anything in {} before first header separator. E.g.: {trim= false } | |A | B | C| | |X | Y | Z| Then we could also add other directives, e.g. for the default sorting of the data.
        Hide
        Frank Grimm added a comment -

        I think that usually users would indeed want trimming. So, turning it off on demand sounds good.

        Please let me know if I can be of any help with implementing this...

        Show
        Frank Grimm added a comment - I think that usually users would indeed want trimming. So, turning it off on demand sounds good. Please let me know if I can be of any help with implementing this...
        Mauro Talevi made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mauro Talevi made changes -
        Assignee Mauro Talevi [ maurotalevi ]
        Fix Version/s 3.1 [ 16511 ]
        Mauro Talevi made changes -
        Summary Leading and trailing spaces in example table cells are removed Allow leading and trailing spaces to be preserved in example table cells
        Issue Type Bug [ 1 ] Improvement [ 4 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Frank Grimm
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: