Skip to content

Breaking change in v1.5.1 #330

@Gilthoniel

Description

@Gilthoniel

The latest release changes the way arguments are matched which is causing a breaking behavior compared to previous versions.

See #295.

Operating system and Go Version

Ubuntu 22.04 and Go v1.21.1

Issue

Arguments must now always be provided otherwise it does not match anymore.

Reproduction steps

func TestExample(t *testing.T) {
	db, mockDB, err := sqlmock.New()
	require.NoError(t, err)

	mockDB.ExpectExec(`UPDATE "foo" SET "bar" .*`).WillReturnResult(sqlmock.NewResult(0, 1))

	_, err = db.Exec(`UPDATE "foo" SET "bar" = $1`, 42)
	require.NoError(t, err)
}

Expected Result

Instead of introducing a breaking change, the behavior should be enabled explicitly by the developer. Here an error is returned.

Actual Result

It should not return an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions