groovy
  1. groovy
  2. GROOVY-2613

add 'transform to platform newline' function to the GDK String API

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6-rc-2, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Triple quoted strings are very useful in unit tests. But there is a problem when you create the expected value with triple quoted strings and the actual value is for example produced by a writer. On windows the two values are not equal, as triple quoted strings use always '\' as the line separator. I don't know the reason why triple quoted strings behave like. But it would be nice to have a straight forward way to turn a triple quoted String into its platform specific form. The PlatformLineWriter is offering such a functionality, but it is obviously not that straightforward to use it. Therefore I propose to have a new method for the GDK String API that does what PlatformLineWriter does: gobbles any \r characters and replaces every \n with a platform specific newline.

        Activity

        Hide
        Paul King added a comment -

        There is now a DGM.normalize(String) method. Do you think that would be sufficient? In the scenario above you would normalize what the writer gave you then compare it to the expected. The alternative would be to also provide a DGM.denormalize(String) method.

        Show
        Paul King added a comment - There is now a DGM.normalize(String) method. Do you think that would be sufficient? In the scenario above you would normalize what the writer gave you then compare it to the expected. The alternative would be to also provide a DGM.denormalize(String) method.
        Hide
        Paul King added a comment -

        There is now a DGM.denormalize(String) method in trunk.

        Show
        Paul King added a comment - There is now a DGM.denormalize(String) method in trunk.
        Hide
        Paul King added a comment -

        Fixed. Thanks for the issue.

        Show
        Paul King added a comment - Fixed. Thanks for the issue.

          People

          • Assignee:
            Paul King
            Reporter:
            Hans Dockter
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: