MCPcopy
hub / github.com/lmorg/murex / TestSpellcheckCrLf

Function TestSpellcheckCrLf

utils/spellcheck/spellcheck_test.go:45–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func 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
81func TestSpellcheckZeroLenStr(t *testing.T) {
82 if os.Getenv("MUREX_TEST_SKIP_SPELLCHECK") != "" {

Callers

nothing calls this directly

Calls 7

TestsFunction · 0.92
InitEnvFunction · 0.92
StringFunction · 0.92
ExpandConstsFunction · 0.92
configDefaultsFunction · 0.85
SetMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected