(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestSpellcheckCrLf(t *testing.T) { |
| 46 | if os.Getenv("MUREX_TEST_SKIP_SPELLCHECK") != "" { |
| 47 | t.Skip("Environmental variable `MUREX_TEST_SKIP_SPELLCHECK` set") |
| 48 | return |
| 49 | } |
| 50 | |
| 51 | count.Tests(t, 1) |
| 52 | lang.InitEnv() |
| 53 | //defaults.Defaults(lang.ShellProcess.Config, false) |
| 54 | configDefaults(lang.ShellProcess.Config) |
| 55 | |
| 56 | err := lang.ShellProcess.Config.Set("shell", "spellcheck-enabled", true, nil) |
| 57 | if err != nil { |
| 58 | t.Fatalf("Unable to set spellcheck-enabled config: %s", err) |
| 59 | } |
| 60 | |
| 61 | err = lang.ShellProcess.Config.Set("shell", "spellcheck-func", `{ -> jsplit ' ' -> suffix "\n" }`, nil) |
| 62 | if err != nil { |
| 63 | t.Fatalf("Unable to set spellcheck-func config: %s", err) |
| 64 | } |
| 65 | |
| 66 | line := "the quick brown fox" |
| 67 | newLine, err := spellcheck.String(line) |
| 68 | ansiLine := ansi.ExpandConsts("{UNDERLINE}the{UNDEROFF} {UNDERLINE}quick{UNDEROFF} {UNDERLINE}brown{UNDEROFF} {UNDERLINE}fox{UNDEROFF}") |
| 69 | |
| 70 | if newLine != ansiLine { |
| 71 | t.Error("spellcheck output doesn't match expected:") |
| 72 | t.Logf(" Expected: '%s'", ansiLine) |
| 73 | t.Logf(" Actual: '%s'", newLine) |
| 74 | } |
| 75 | |
| 76 | if err != nil { |
| 77 | t.Errorf("spellcheck produced an error: %s", err.Error()) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func TestSpellcheckZeroLenStr(t *testing.T) { |
| 82 | if os.Getenv("MUREX_TEST_SKIP_SPELLCHECK") != "" { |
nothing calls this directly
no test coverage detected