thint.nim 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. discard """
  2. matrix: "--styleCheck:hint"
  3. action: compile
  4. """
  5. # Test violating ident definition:
  6. {.pragma: user_pragma.} #[tt.Hint
  7. ^ 'user_pragma' should be: 'userPragma' [Name] ]#
  8. # Test violating ident usage style matches definition style:
  9. {.userPragma.} #[tt.Hint
  10. ^ 'userPragma' should be: 'user_pragma' [template declared in thint.nim(7, 9)] [Name] ]#
  11. # Test violating builtin pragma usage style:
  12. {.no_side_effect.}: #[tt.Hint
  13. ^ 'no_side_effect' should be: 'noSideEffect' [Name] ]#
  14. discard 0
  15. # Test:
  16. # - definition style violation
  17. # - user pragma usage style violation
  18. # - builtin pragma usage style violation
  19. proc generic_proc*[T] {.no_destroy, userPragma.} = #[tt.Hint
  20. ^ 'generic_proc' should be: 'genericProc' [Name]; tt.Hint
  21. ^ 'no_destroy' should be: 'nodestroy' [Name]; tt.Hint
  22. ^ 'userPragma' should be: 'user_pragma' [template declared in thint.nim(7, 9)] [Name] ]#
  23. # Test definition style violation:
  24. let snake_case = 0 #[tt.Hint
  25. ^ 'snake_case' should be: 'snakeCase' [Name] ]#
  26. # Test user pragma definition style violation:
  27. {.pragma: another_user_pragma.} #[tt.Hint
  28. ^ 'another_user_pragma' should be: 'anotherUserPragma' [Name] ]#
  29. # Test user pragma usage style violation:
  30. {.anotherUserPragma.} #[tt.Hint
  31. ^ 'anotherUserPragma' should be: 'another_user_pragma' [template declared in thint.nim(31, 11)] [Name] ]#
  32. # Test violating builtin pragma usage style:
  33. {.no_side_effect.}: #[tt.Hint
  34. ^ 'no_side_effect' should be: 'noSideEffect' [Name] ]#
  35. # Test usage style violation:
  36. discard snakeCase #[tt.Hint
  37. ^ 'snakeCase' should be: 'snake_case' [let declared in thint.nim(28, 7)] [Name] ]#
  38. generic_proc[int]()