Skip to content

Conversation

Harshit-Khasnis
Copy link
Contributor

No description provided.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 14, 2025

func TestBooleanNegativeInvalidDBValue(t *testing.T) {
// Insert invalid value directly (bypassing GORM)
if err := DB.Exec("INSERT INTO BOOLEAN_TEST (ID, FLAG) VALUES (999, 2)").Error; err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the table name be "boolean_tests"?

DB.Create(&BooleanTest{Flag: false})

var trues []BooleanTest
if err := DB.Where("FLAG = ?", true).Find(&trues).Error; err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after Find(&trues), add an assert for the expected number of rows (or at least that >= 1 rows were returned).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like:
if len(trues) == 0 { t.Fatalf("expected at least 1 row, got 0") }

"testing"
)

type BooleanTest struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for using int number for Boolean column

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants