Skip to content

[FEAT] Test Suite#3

Merged
bbengfort merged 2 commits intomainfrom
testsuite
Apr 4, 2026
Merged

[FEAT] Test Suite#3
bbengfort merged 2 commits intomainfrom
testsuite

Conversation

@bbengfort
Copy link
Copy Markdown
Contributor

@bbengfort bbengfort commented Apr 3, 2026

Scope of changes

Implements a test suite for automated testing of generated code.

Estimated PR Size:

  • Tiny
  • Small
  • Medium
  • Large
  • Huge

Acceptance criteria

This PR will be merged without review.

Author checklist

  • I have manually tested the change and/or added automation in the form of unit tests or integration tests
  • I have updated the dependencies list
  • I have added new test fixtures as needed to support added tests
  • I have added or updated the documentation
  • I have run go generate to update generated code

Note

Low Risk
Changes are limited to tests and a new TestSuite helper; no production parsing logic is modified. Main risk is potential flaky tests due to randomized case/space/mangling generation.

Overview
Adds a reusable generic enumify.TestSuite to automatically validate generated enum code for interface compliance, String() behavior (including bounds/unknown handling), parse coverage across numeric and string forms, and basic DB string-length constraints.

Updates the test Status enum to include the (previously implied) generated methods for string/JSON/YAML/SQL scan+value behavior, and tweaks ParseFactory invalid-value test cases to assert negative-number error formatting. Includes a small smoke test (testing_test.go) that runs the new suite against Status.

Reviewed by Cursor Bugbot for commit abfc49a. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit abfc49a. Configure here.

}
}
return string(b)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

mangle leaves most characters as null runes

Medium Severity

mangle allocates a zero-valued rune slice and only populates ~25% of the characters with random digits. The remaining ~75% stay as \x00 (null runes), producing strings full of null characters instead of recognizably mangled versions of the input. The else branch that copies the original character from the input string is missing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit abfc49a. Configure here.

b[i] = r
}
return string(b)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

mixedCase uses byte index for rune slice

Medium Severity

mixedCase allocates its rune slice with len(s) (byte count) but indexes into it using byte positions from range s. For multi-byte characters, byte indices skip values, leaving intermediate positions as \x00 null runes and producing a corrupted output string. This affects any enum names containing non-ASCII characters.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit abfc49a. Configure here.

@bbengfort bbengfort merged commit 2ff1597 into main Apr 4, 2026
6 checks passed
@bbengfort bbengfort deleted the testsuite branch April 4, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant