feat: added unit tests
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
package buffer
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestReadConsole(t *testing.T) {
|
||||||
|
mockMessage := "Reading for Unit test of readconsole"
|
||||||
|
|
||||||
|
inputBuffer := &InputBuffer{
|
||||||
|
Buffer: "",
|
||||||
|
Reader: bufio.NewReader(strings.NewReader(mockMessage)),
|
||||||
|
}
|
||||||
|
|
||||||
|
inputBuffer.ReadConsole()
|
||||||
|
|
||||||
|
if inputBuffer.Buffer != mockMessage {
|
||||||
|
t.Errorf("ReadConsole() should be %q but is %q", mockMessage, inputBuffer.Buffer)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,10 +9,18 @@ build:
|
|||||||
start:
|
start:
|
||||||
@./tmp/${BINARY_NAME}
|
@./tmp/${BINARY_NAME}
|
||||||
|
|
||||||
|
test-unit:
|
||||||
|
@go test ./internals/... -v
|
||||||
|
|
||||||
|
test-inte:
|
||||||
|
@go test ./tests/... -v
|
||||||
|
|
||||||
|
test: build test-unit test-inte
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@go clean
|
@go clean
|
||||||
@rm -rf ${BINARY_NAME}
|
@rm -rf ${BINARY_NAME}
|
||||||
|
|
||||||
reset: clean build
|
reset: clean build test clean
|
||||||
|
|
||||||
.PHONY: clean build
|
.PHONY: clean build test
|
||||||
|
|||||||
Reference in New Issue
Block a user