Test against canonical extJSON when relaxed extJSON is unset

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None

      As part of RUST-1129, we discovered that a boundary condition on date representation was incorrect for relaxed extJSON but correct for canonical extJSON; this wasn't caught by the corpus tests because the [relevant test](https://github.com/mongodb/specifications/blob/372747fca128f449abbbb01b200dc9a2cabf522d/source/bson-corpus/tests/datetime.json#L24-L28) doesn't have relaxed expected output.

      Potentially, in this case we could test against the canonical expected output (and recommend that for adoption in other drivers). However, initial test with that logic in place showed other failures that need to be investigated before that can move forward:

      ---- tests::spec::corpus::run stdout ----
      {{ thread 'tests::spec::corpus::run' panicked at 'assertion failed: `(left == right)`: Multiple types within the same document: All BSON types}}Diff < left / right > :
      {{ Object(}}{{{ "_id": Object( Unknown macro: }}
      {{

      { "$oid"}}}

      {{ ),}}
      {{ "String": String(}}
      {{ "string",}}
      {{ ),}}
      {{ < "Int32": Number(}}
      {{ < 42,}}
      {{ < ),}}
      {{ < "Int64": Number(}}
      {{ < 42,}}
      {{ < ),}}
      {{ < "Double": Number(}}
      {{ < -1.0,}}
      {{ < ),}}
      {{ > "Int32": Object(}}
      {{ Unknown macro: {> "$numberInt"}}}
      {{ ),}}
      {{ > "Int64": Object(}}
      {{ Unknown macro: {> "$numberLong"}}}
      {{ ),}}
      {{ > "Double": Object(}}
      {{ Unknown macro: {> "$numberDouble"}}}
      {{ ),}}
      {{ "Binary": Object(}}

      {{ { "$binary": Object( Unknown macro: }}
      { "base64"}}}

      {{ ),}}
      {{ }),}}
      {{ "BinaryUserDefined": Object(}}

      {{ { "$binary": Object( Unknown macro: }}
      {{{ "base64"}


      {{ ),}}
      {{ }),}}
      {{ "Code": Object({}}
      {{ "$code": String(}}
      {{ "function() {}",}}
      {{ ),}}
      {{ }),}}
      {{ "CodeWithScope": Object({}}
      {{ "$code": String(}}
      {{ "function() {}",}}
      {{ ),}}
      {{ "$scope": Object({}),}}
      {{ }),}}
      {{ "Subdocument": Object(}}
      {{ Unknown macro: { "foo"}}}
      {{ ),}}
      {{ "Array": Array([}}
      {{ < Number(}}
      {{ < 1,}}
      {{ < ),}}
      {{ < Number(}}
      {{ < 2,}}
      {{ < ),}}
      {{ < Number(}}
      {{ < 3,}}
      {{ < ),}}
      {{ < Number(}}
      {{ < 4,}}
      {{ < ),}}
      {{ < Number(}}
      {{ < 5,}}
      {{ < ),}}
      {{ > Object(}}
      {{ Unknown macro: {> "$numberInt"}}}
      {{ ),}}
      {{ > Object(}}
      {{ Unknown macro: {> "$numberInt"}}}
      {{ ),}}
      {{ > Object(}}
      {{ Unknown macro: {> "$numberInt"}}}
      {{ ),}}
      {{ > Object(}}
      {{ Unknown macro: {> "$numberInt"}}}
      {{ ),}}
      {{ > Object(}}
      {{ Unknown macro: {> "$numberInt"}}}
      {{ ),}}
      {{ ]),}}
      {{ "Timestamp": Object(}}

      {{ { "$timestamp": Object( Unknown macro: }}
      { "t"}

      {{ ),}}
      {{ }),}}
      {{ "Regex": Object(}}

      {{ { "$regularExpression": Object( Unknown macro: }}
      { "pattern"}

      {{ ),}}
      {{ }),}}
      {{ "DatetimeEpoch": Object(}}

      {{ { < "$date": String( < "1970-01-01T00:00:00Z", < ), > "$date": Object( Unknown macro: }}
      {> "$numberLong"}}}

      {{ ),}}
      {{ }),}}
      {{ "DatetimePositive": Object(}}

      {{ { < "$date": String( < "1970-01-25T20:31:23.647Z", < ), > "$date": Object( Unknown macro: }}
      {{{> "$numberLong"}


      {{ ),}}
      {{ }),}}
      {{ "DatetimeNegative": Object(}}

      {{ { "$date": Object( Unknown macro: }}
      { "$numberLong"}

      {{ ),}}
      {{ }),}}
      {{ "True": Bool(}}
      {{ true,}}
      {{ ),}}
      {{ "False": Bool(}}
      {{ false,}}
      {{ ),}}
      {{ "DBRef": Object(}}

      {{ { "$ref": String( "collection", ), "$id": Object( Unknown macro: }}
      {{{ "$oid"}

      }}),
      {{ "$db": String(}}
      {{ "database",}}
      {{ ),}}
      {{ }),}}
      {{ "Minkey": Object(}}
      {{ Unknown macro: { "$minKey"}}}
      {{ ),}}
      {{ "Maxkey": Object(}}
      {{ Unknown macro: { "$maxKey"}}}
      {{ ),}}
      {{ "Null": Null,}}
      {{ })}}

            Assignee:
            Unassigned
            Reporter:
            Abraham Egnor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: