Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6314

Numeric.new (and subtypes) does not accept whitespace between sign and leading digit

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.5.0
    • Fix Version/s: PUP 4.5.3
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Language 2016-07-13
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Numeric.new, Integer.new, Float.new did not previously allow spaces between a positive/negative sign and a leading digit

      Description

      The following Puppet code:

      notice Integer.new('+ 1')
      

      results in the following error:

      Error while evaluating a Function Call, invalid value for Integer(): "+ 1"
      

      Expected this to print:

      Notice: Scope(Class[main]): 1
      

      The problem is the whitespace between the sign and the leading digit in the number; we support it for arithmetic String to Integer conversions (e.g. notice '+ 1' + '- 1' results in 0), so I expect Integer.new to be consistent with that conversion.

      Note: this also affects Float.new (and by extension Numeric.new).

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  peter.huene Peter Huene
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: