Skip to content

Commit

Permalink
Improve test case
Browse files Browse the repository at this point in the history
  • Loading branch information
HindujaB committed Nov 22, 2023
1 parent 0974f3f commit 4c81b9e
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4645,12 +4645,11 @@ function testLast() {
assertTrue([] == value:last(ar1, ar));
}


public type Copybook record {
DFHCOMMAREA DFHCOMMAREA?;
DFH\-COMMAREA DFH\-COMMAREA?;
};

public type DFHCOMMAREA record {
public type DFH\-COMMAREA record {
record {
string MI\-HDR\-VERSION?;
string MI\-HDR\-MSGID?;
Expand All @@ -4663,7 +4662,7 @@ public type DFHCOMMAREA record {

function testCloneWithTypeToRecordWithSpecialChars() {
string s = string `{
"DFHCOMMAREA": {
"DFH-COMMAREA": {
"BROKER-MESSAGE-AREA": {
"MI-HDR-VERSION": "2",
"MI-HDR-MSGID":"3238763233323598798798712321187612",
Expand All @@ -4673,10 +4672,10 @@ function testCloneWithTypeToRecordWithSpecialChars() {
}`;
json rec = checkpanic value:fromJsonString(s);
map<json> mapJson = checkpanic rec.ensureType();
Copybook|error dfhcommarea = mapJson.cloneWithType();
assertTrue(dfhcommarea is Copybook);
Copybook cb = checkpanic dfhcommarea.ensureType();
assertEquality(cb.DFHCOMMAREA?.BROKER\-MESSAGE\-AREA.toString(), string `{"MI-HDR-VERSION":"2","MI-HDR-MSGID":"3238763233323598798798712321187612","MI-HDR-LOGGINGID":"Z5118761-Z"}`);
Copybook|error dfh\-commarea = mapJson.cloneWithType();
assertTrue(dfh\-commarea is Copybook);
Copybook cb = checkpanic dfh\-commarea.ensureType();
assertEquality(cb.DFH\-COMMAREA?.BROKER\-MESSAGE\-AREA.toString(), string `{"MI-HDR-VERSION":"2","MI-HDR-MSGID":"3238763233323598798798712321187612","MI-HDR-LOGGINGID":"Z5118761-Z"}`);
}

type AssertionError distinct error;
Expand Down

0 comments on commit 4c81b9e

Please sign in to comment.