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.

48 lines
953 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. Input: "((Remove :01 goofs!*))",
  30. Output: "((Remove :01 goofs!*))",
  31. },
  32. }
  33. for i, row := range table {
  34. t.Run(fmt.Sprintf("Row_%d", i), func(t *testing.T) {
  35. result := util.RemoveNPCAttribution(row.Input)
  36. if result != row.Output {
  37. t.Errorf("Row %d failed", i)
  38. t.Errorf("Expected: %#+v", row.Output)
  39. t.Errorf("Result: %#+v", result)
  40. }
  41. })
  42. }
  43. }