encodedText_test.go 646 B

12345678910111213141516171819202122232425262728293031323334
  1. package weirdtext
  2. import (
  3. "testing"
  4. )
  5. func TestInvalidPrefix(t *testing.T) {
  6. input := `
  7. ---weir---
  8. Tihs is a lnog lnooog tset setcnnee,
  9. wtih smoe big (biiiiig) wdros!
  10. ---weir---
  11. This long looong sentence some test with words`
  12. test := EncodedText{}
  13. err := test.FromString(input)
  14. if err == nil {
  15. t.Errorf("There should be error as prefix is invalid!")
  16. }
  17. }
  18. func TestInvalidString(t *testing.T) {
  19. input := `
  20. ---weird---
  21. Tihs is a lnog lnooog tset setcnnee,
  22. wtih smoe big (biiiiig) wdros!
  23. ---weird---`
  24. test := EncodedText{}
  25. err := test.FromString(input)
  26. if err == nil {
  27. t.Errorf("There should be error as string is invalid!")
  28. }
  29. }