Skip to content

Commit

Permalink
Add tests for immutable types
Browse files Browse the repository at this point in the history
  • Loading branch information
SasinduDilshara committed Oct 11, 2024
1 parent 8fe12eb commit 900ac32
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ballerina/tests/from_json_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ isolated function testSimpleJsonToRecord3() returns Error? {
test:assertEquals(r, {id: 4012, age: 27, name: {firstname: "John", lastname: "Doe"}});
}

type UserRecord3 ReadOnlyUserRecord2;

@test:Config
isolated function testSimpleJsonToRecord4() returns Error? {
json user = {id: 4012, name: {firstname: "John", lastname: "Doe"}, age: 27};
UserRecord3 r = check parseAsType(user);
test:assertEquals(r, {id: 4012, age: 27, name: {firstname: "John", lastname: "Doe"}});
}

@test:Config
isolated function testSimpleJsonToRecordWithProjection() returns Error? {
json j = {"a": "hello", "b": 1};
Expand Down

0 comments on commit 900ac32

Please sign in to comment.