Skip to content

Commit

Permalink
fixed error in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
tot0p committed Feb 26, 2024
1 parent 4288cb9 commit 4612b22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
16 changes: 6 additions & 10 deletions interpreter/eclaType/char_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,23 +914,19 @@ func TestCharAppendChar(t *testing.T) {
t1 := Char('A')
t2 := Char('B')

result, err := t1.Append(t2)
if err != nil {
t.Error(err)
} else if result.GetValue() != String("AB") {
t.Error("Expected AB, got ", result)
_, err := t1.Append(t2)
if err == nil {
t.Error("Expected error")
}
}

func TestCharAppendString(t *testing.T) {
t1 := Char('A')
t2 := String("BC")

result, err := t1.Append(t2)
if err != nil {
t.Error(err)
} else if result.GetValue() != String("ABC") {
t.Error("Expected ABC, got ", result)
_, err := t1.Append(t2)
if err == nil {
t.Error("Expected error")
}
}

Expand Down
8 changes: 4 additions & 4 deletions interpreter/eclaType/function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
// Useless tests for code coverage purpose
func TestGetValue(t *testing.T) {
f := NewFunction("test", nil, nil, nil)
if f.GetValue() != nil {
t.Errorf("Expected nil, got %v", f.GetValue())
if f.GetValue() == nil {
t.Error("Expected not nil, got nil")
}
}

Expand All @@ -36,8 +36,8 @@ func TestGetString(t *testing.T) {

func TestGetType(t *testing.T) {
f := NewFunction("test", nil, nil, nil)
if f.GetType() != "function" {
t.Errorf("Expected function, got %v", f.GetType())
if f.GetType() != "function()" {
t.Errorf("Expected function(), got %v", f.GetType())
}
}

Expand Down

0 comments on commit 4612b22

Please sign in to comment.