1
0
Fork 0

Slightly increase code coverage
timw4mail/gilo/pipeline/head This commit looks good Details

This commit is contained in:
Timothy Warren 2023-10-04 12:50:21 -04:00
parent fa584a6306
commit 4fdb0a607c
3 changed files with 23 additions and 2 deletions

View File

@ -17,3 +17,12 @@ func TestNewPoint(t *testing.T) {
t.Errorf("Failure to create proper Point")
}
}
func TestPoint_Clone(t *testing.T) {
point := DefaultPoint()
point2 := point.Clone()
if point == point2 {
t.Errorf("Point is identical, not cloned")
}
}

View File

@ -1,6 +1,9 @@
package key
import "unicode"
import (
"strings"
"unicode"
)
// ----------------------------------------------------------------------------
// !Terminal Input Escape Code Sequences
@ -39,5 +42,5 @@ func Ctrl(char rune) rune {
// IsSeparator Is the character a general token separator type?
func IsSeparator(char rune) bool {
return unicode.IsPunct(char) || unicode.IsSpace(char)
return unicode.IsSpace(char) || strings.ContainsRune(",.()+-/*=~%<>[];", char)
}

View File

@ -59,3 +59,12 @@ func TestCtrl(t *testing.T) {
}
}
}
func TestIsSeparator(t *testing.T) {
separators := ",.()+-/*=~%<>[] \t"
for _, r := range separators {
if !IsSeparator(r) {
t.Errorf("Expected %q to be a syntax separator", r)
}
}
}