Multi struct test case
Go Tests / test (push) Successful in 1m3s

This commit is contained in:
2026-06-06 10:34:47 +02:00
parent 90d7bf7226
commit 30e148f0e3
3 changed files with 32 additions and 2 deletions
+20
View File
@@ -113,3 +113,23 @@ func TestParseCompositeFk(t *testing.T) {
t.Fail()
}
}
func TestParseStructWithJsonTag(t *testing.T) {
// GIVEN
orm := simpleorm.NewORM(TestWithJsonStructTag{})
// WHEN
ddl, err := orm.CreateSchema()
// THEN
if err != nil {
log.LogError("Failed to parse schema! %s", err)
t.Fail()
}
expectedDdl := "CREATE TABLE IF NOT EXISTS TEST_WITH_JSON_STRUCT_TAG (ID INTEGER, INT64_FIELD BIGINT NOT NULL, INT_FIELD INTEGER NOT NULL, STRING_FIELD TEXT NOT NULL, CONSTRAINT pk_test_with_json_struct_tag PRIMARY KEY(ID));"
if ddl != expectedDdl {
log.LogError("Incorrect DDL.\nExpected\n%s\nActual\n%s", expectedDdl, ddl)
log.LogError("\nExpected size: %s\nActual size: %s", strconv.Itoa(len(expectedDdl)), strconv.Itoa(len(ddl)))
t.Fail()
}
log.LogInfo("Test finished!")
}