From 4fdb0a607c5a99839cef4a69d989683d426d87de Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 4 Oct 2023 12:50:21 -0400 Subject: [PATCH] Slightly increase code coverage --- internal/gilo/point_test.go | 9 +++++++++ key/key.go | 7 +++++-- key/key_test.go | 9 +++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/internal/gilo/point_test.go b/internal/gilo/point_test.go index 5c07cc8..9bff440 100644 --- a/internal/gilo/point_test.go +++ b/internal/gilo/point_test.go @@ -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") + } +} diff --git a/key/key.go b/key/key.go index 3221032..04af779 100644 --- a/key/key.go +++ b/key/key.go @@ -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) } diff --git a/key/key_test.go b/key/key_test.go index 6ed22a4..2f73d1b 100644 --- a/key/key_test.go +++ b/key/key_test.go @@ -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) + } + } +}