Skip to content

re 1.12 broke tests in a dose3 #411

@RiderALT

Description

@RiderALT

All tests associated with comparing versions through semver in dose3-7.0.0 are breaking.
I think that arrays are incorrectly filled when analyzing the version by regular expression.

With ocaml-re 1.11 everything works fine.

And with ocaml-re 1.12:
FAILED: Cases: 112 Tried: 112 Errors: 0 Failures: 21 Skip: 0 Todo: 0 Timeouts: 0.

One example of the output from the list of broken tests:

Failure: suite:5:test_decompose:5: =1.2.3
expected: 1.2.3-+ but got: 1.2.3

part of the src/versioning/semverNode.ml from dose3:

let rex =
  Pcre.regexp
    ("^\\s*[v=]*\\s*"
   (* optional version identifier *)
   ^ "([0-9]+|[xX*])(\\.([0-9]+|[xX*])?(\\.([0-9]+|[xX*])?)?)?"
    (* 3-dotted notation *)
    ^ "(?:-((?:[a-zA-Z0-9]+|[a-zA-Z0-9-])(?:\\.[a-zA-Z0-9]+|[a-zA-Z0-9-])*))?"
    ^ (* pre release *)
    "(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?\\s*$" (* build indentifier *)
    )

let sep_re = Pcre.regexp "\\."

let parse_raw_version version =
  try
    let parsed = Pcre.extract ~rex version in
    let pre = Pcre.split ~rex:sep_re parsed.(6) in
    let build = Pcre.split ~rex:sep_re parsed.(7) in
    (parsed.(1), parsed.(3), parsed.(5), pre, build)
  with Not_found ->
    raise
      (Invalid_argument
         (Printf.sprintf "%s: Parsing Error. Invalid Version" version))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions