Browse Source

Delete util

Benton Edmondson 1 year ago
parent
commit
d652b98737
2 changed files with 13 additions and 17 deletions
  1. 13 5
      ansi/ansi_test.go
  2. 0 12
      util/util.go

+ 13 - 5
ansi/ansi_test.go

@@ -2,7 +2,6 @@ package ansi
 
 import (
 	"fmt"
-	"mimicry/util"
 	"testing"
 )
 
@@ -103,11 +102,15 @@ func TestWrap(t *testing.T) {
 
 	for _, test := range tests {
 		output := Wrap(test.Input, test.Limit)
-		util.AssertEqual(test.Expected, output, t)
+		if test.Expected != output {
+			t.Fatalf("expected %s but got %s", test.Expected, output)
+		}
 
 		// Test that `Wrap` is idempotent
 		identical := Wrap(test.Expected, test.Limit)
-		util.AssertEqual(test.Expected, identical, t)
+		if test.Expected != identical {
+			t.Fatalf("expected %s but got %s", test.Expected, identical)
+		}
 	}
 }
 
@@ -125,7 +128,9 @@ func TestCodeBlock(t *testing.T) {
   test  
   everyt
   hing  `
-	util.AssertEqual(expected, indented, t)
+	if expected != indented {
+		t.Fatalf("expected %s but got %s", expected, indented)
+	}
 
 	fmt.Println("This should look like a nice, indented code block:")
 	styled := Indent(Apply(padded, "48;2;75;75;75"), "  ", true)
@@ -187,7 +192,10 @@ func TestSnip(t *testing.T) {
 
 	for _, test := range tests {
 		output := Snip(test.Input, test.Width, test.Height, "…")
-		util.AssertEqual(test.Expected, output, t)
+		
+		if test.Expected != output {
+			t.Fatalf("expected %s but got %s", test.Expected, output)
+		}
 	}
 }
 

+ 0 - 12
util/util.go

@@ -1,12 +0,0 @@
-package util
-
-import (
-	"testing"
-)
-
-// TODO: delete this function
-func AssertEqual(expected string, output string, t *testing.T) {
-	if expected != output {
-		t.Fatalf("Expected `%s` not `%s`\n", expected, output)
-	}
-}