utils_test.go 573 B

12345678910111213141516171819202122232425262728
  1. package codegen
  2. import (
  3. "testing"
  4. )
  5. func TestLowerTitle(t *testing.T) {
  6. // empty
  7. if LowerTitle("") != "" {
  8. t.Fatal("expected empty title to remain empty")
  9. }
  10. // all lowercase
  11. if LowerTitle("lowercase") != "lowercase" {
  12. t.Fatal("expected no changes when input is all lowercase")
  13. }
  14. // all uppercase
  15. if LowerTitle("UPPERCASE") != "uPPERCASE" {
  16. t.Fatal("expected first rune to be lower when input is all uppercase")
  17. }
  18. // Title Case
  19. if LowerTitle("Title Case") != "title Case" {
  20. t.Fatal("expected first rune to be lower when input is Title Case")
  21. }
  22. }