The new logbot, not committed from the wrong terminal window this time.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
870 B

  1. package util_test
  2. import (
  3. "fmt"
  4. "testing"
  5. "git.aiterp.net/rpdata/logbot3/internal/util"
  6. )
  7. func TestRemoveNPCAttribution(t *testing.T) {
  8. table := []struct {
  9. Input string
  10. Output string
  11. }{
  12. {
  13. Input: "Character does stuff. (Player_Name)",
  14. Output: "Character does stuff.",
  15. },
  16. {
  17. Input: "Text (with some clarification) about stuff.",
  18. Output: "Text (with some clarification) about stuff.",
  19. },
  20. {
  21. Input: "Text without anything.",
  22. Output: "Text without anything.",
  23. },
  24. {
  25. Input: "((*Correction))",
  26. Output: "((*Correction))",
  27. },
  28. }
  29. for i, row := range table {
  30. t.Run(fmt.Sprintf("Row_%d", i), func(t *testing.T) {
  31. result := util.RemoveNPCAttribution(row.Input)
  32. if result != row.Output {
  33. t.Errorf("Row %d failed", i)
  34. t.Errorf("Expected: %#+v", row.Output)
  35. t.Errorf("Result: %#+v", result)
  36. }
  37. })
  38. }
  39. }