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

Passing SemVer prerelease or build as a hash doesn't work

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 6.23.0, PUP 7.8.0
    • None
    • Coremunity
    • Platform Core KANBAN
    • Needs Assessment
    • Bug Fix
    • Hide
      Fixes a bug that prevented the build and prerelease components of the SemVer data type from being passed as a list of arguments or hash:

      SemVer(major => 1, minor => 0, patch => 0, prerelease => "beta", build => "123")
      SemVer(1, 0, 0, "beta", "123")
      Show
      Fixes a bug that prevented the build and prerelease components of the SemVer data type from being passed as a list of arguments or hash: SemVer(major => 1, minor => 0, patch => 0, prerelease => "beta", build => "123") SemVer(1, 0, 0, "beta", "123")
    • Needs Assessment

    Description

      The language specification says you should be able to pass the SemVer prerelease and build components as a hash or list of arguments. However, the values are corrupted when SemVer objects are created this way:

      ❯ bx puppet apply  -e 'notice(SemVer(major => 1, minor => 0, patch => 0, prerelease => "alpha"))'
      Notice: Scope(Class[main]): 1.0.0-a.l.p.h.a
      ...
      ❯ bx puppet apply  -e 'notice(SemVer(major => 1, minor => 0, patch => 0, build => "123"))'       
      Notice: Scope(Class[main]): 1.0.0+1.2.3
      ...
      

      Note the extra dots in the output. This leads to confusing behavior:

      ❯ bx puppet apply  -e 'notice(SemVer(major => 1, minor => 0, patch => 0, build => "123") == SemVer("1.0.0+123"))'
      Notice: Scope(Class[main]): false
      

      Passing the build and prerelease components in the string version does work, because internally SemanticPuppet::Version.parse converts the String component to an array.

      The problem is that the SemVer data type needs to pass the build and prerelease components as a single element array when calling SemanticPuppet::Version.new(.., prerelease, build)

      Attachments

        Issue Links

          Activity

            People

              josh Josh Cooper
              josh Josh Cooper
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support