Skip to content

util: Add tests for rune, whitespace and path helpers - #4154

Open
Qalipso wants to merge 1 commit into
micro-editor:masterfrom
Qalipso:util_test_coverage
Open

util: Add tests for rune, whitespace and path helpers#4154
Qalipso wants to merge 1 commit into
micro-editor:masterfrom
Qalipso:util_test_coverage

Conversation

@Qalipso

@Qalipso Qalipso commented Jul 28, 2026

Copy link
Copy Markdown

internal/util is at 10.7% statement coverage, despite being made up largely of small pure helpers that are easy to test and are used throughout the editor.

This adds table-driven tests for:

  • rune classification (IsWordChar, IsAlphanumeric, IsUpper/LowerLetter, IsAutocomplete, …)
  • whitespace helpers (GetLeadingWhitespace, GetTrailingWhitespace, IsSpacesOrTabs, …)
  • rune-indexed slicing (SliceStart, SliceEnd, and the string variants)
  • IndexAnyUnquoted, ParseBool, Clamp, Abs, Min/Max, IntOpt
  • GetPathAndCursorPosition, including the Windows absolute path case
  • GetCharPosInLine tab handling and HashStringMd5
  • character decoding and counting with combining marks (DecodeCharacter, CharacterCount)
  • the Lua helper wrappers in lua.go

Coverage goes from 10.7% to 61.5%. No non-test code is changed; go vet and go test -race pass.

internal/util was at 10.7% statement coverage. This covers the pure
helpers: rune classification, whitespace handling, rune-indexed slicing,
unquoted index scanning, bool parsing, path/cursor parsing, md5 hashing,
character decoding with combining marks, and the Lua helper wrappers.

Coverage goes from 10.7% to 61.5%. No non-test code is changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant