add small and useless test
This commit is contained in:
@@ -43,7 +43,7 @@ func ParseNIPFile(filePath string) ([]Rule, error) {
|
||||
|
||||
rules := make([]Rule, 0)
|
||||
for fileScanner.Scan() {
|
||||
rule, err := parseLine(fileScanner.Text())
|
||||
rule, err := ParseLine(fileScanner.Text())
|
||||
if errors.Is(err, errEmptyLine) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
propertyNameRegex = regexp.MustCompile(`\[(.*)\]`)
|
||||
)
|
||||
|
||||
func parseLine(line string) (Rule, error) {
|
||||
func ParseLine(line string) (Rule, error) {
|
||||
line = lineCleanup(line)
|
||||
if line == "" {
|
||||
return Rule{}, errEmptyLine
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
const nipLine = "[type] == boots && [quality] == rare # [frw] >= 10 && [fireresist] >= 10 && ([lightresist]+[coldresist] >= 10 && [dexterity] >= 1 && [fireresist]+[poisonresist] >= 10) // this is a comment"
|
||||
|
||||
func Test_parseLine(t *testing.T) {
|
||||
rules, err := parseLine(nipLine)
|
||||
rules, err := ParseLine(nipLine)
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := Rule{
|
||||
|
||||
Reference in New Issue
Block a user