<commit_before>package runner

import (
	"fmt"
	"testing"

	"github.com/kr/pretty"
	"github.com/stretchr/testify/assert"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

func Test_parseSampLoggerFormat(t *testing.T) {
	tests := []struct {
		input string
		msg   string
		want  []zapcore.Field
	}{
		{
			`text="Setting loaded" path="spawn/new-items/1" output="Ammo9mm"`,
			"Setting loaded",
			[]zapcore.Field{
				zap.String("path", "spawn/new-items/1"),
				zap.String("output", "Ammo9mm"),
			},
		},
		{
			`text="Setting loaded" path="this \"thing\" contains quotes"`,
			"Setting loaded",
			[]zapcore.Field{
				zap.String("path", `this "thing" contains quotes`),
			},
		},
		{
			`Registered SIF debug handler 1: 'SIF/Button' initial state: 0`,
			`Registered SIF debug handler 1: 'SIF/Button' initial state: 0`,
			nil,
		},
	}
	for ii, tt := range tests {
		t.Run(fmt.Sprint(ii), func(t *testing.T) {
			_, msg, got := parseSampLoggerFormat(tt.input)
			assert.Equal(t, tt.want, got)
			pretty.Println(msg, got) //nolint:errcheck
		})
	}
}

func Test_parseSampLoggerToMap(t *testing.T) {
	tests := []struct {
		input string
		want  map[string]string
	}{
		{
			`text="Setting loaded" path="spawn/new-items/1" output="Ammo9mm"`,
			map[string]string{
				"text":   "Setting loaded",
				"path":   "spawn/new-items/1",
				"output": "Ammo9mm",
			},
		},
		{
			`text="Setting loaded" path="this \"thing\" contains quotes"`,
			map[string]string{
				"text": "Setting loaded",
				"path": `this "thing" contains quotes`,
			},
		},
		{
			`Registered SIF debug handler 1: 'SIF/Button' initial state: 0`,
			nil,
		},
	}
	for ii, tt := range tests {
		t.Run(fmt.Sprint(ii), func(t *testing.T) {
			got := parseSampLoggerToMap(tt.input)
			assert.Equal(t, tt.want, got)
			pretty.Println(got) //nolint:errcheck
		})
	}
}

func Test_splitLine(t *testing.T) {
	tests := []struct {
		line string
		want []string
	}{
		{
			`text="Setting loaded" path="spawn/new-items/1" output="Ammo9mm"`,
			[]string{
				`text="Setting loaded"`,
				`path="spawn/new-items/1"`,
				`output="Ammo9mm"`,
			},
		},
	}
	for ii, tt := range tests {
		t.Run(fmt.Sprint(ii), func(t *testing.T) {
			got := splitLine(tt.line)
			pretty.Println(got) //nolint:errcheck
		})
	}
}
<commit_msg>updated tests for recent changes to log parser<commit_after>package runner

import (
	"fmt"
	"testing"

	"github.com/kr/pretty"
	"github.com/stretchr/testify/assert"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

var p = ReactiveParser{}

func Test_parseSampLoggerFormat(t *testing.T) {
	tests := []struct {
		input string
		msg   string
		want  []zapcore.Field
	}{
		{
			`lvl=info msg="Setting loaded" path="spawn/new-items/1" output="Ammo9mm"`,
			"Setting loaded",
			[]zapcore.Field{
				zap.String("path", "spawn/new-items/1"),
				zap.String("output", "Ammo9mm"),
			},
		},
		{
			`lvl=info msg="Setting loaded" path="this \"thing\" contains quotes"`,
			"Setting loaded",
			[]zapcore.Field{
				zap.String("path", `this "thing" contains quotes`),
			},
		},
		{
			`Registered SIF debug handler 1: 'SIF/Button' initial state: 0`,
			`Registered SIF debug handler 1: 'SIF/Button' initial state: 0`,
			nil,
		},
	}
	for ii, tt := range tests {
		t.Run(fmt.Sprint(ii), func(t *testing.T) {
			_, msg, got := p.parseSampLoggerFormat(tt.input)
			assert.Equal(t, tt.want, got)
			pretty.Println(msg, got) //nolint:errcheck
		})
	}
}

func Test_parseSampLoggerToMap(t *testing.T) {
	tests := []struct {
		input string
		want  map[string]string
	}{
		{
			`lvl=info msg="Setting loaded" path="spawn/new-items/1" output="Ammo9mm"`,
			map[string]string{
				"lvl":    "info",
				"msg":    "Setting loaded",
				"path":   "spawn/new-items/1",
				"output": "Ammo9mm",
			},
		},
		{
			`lvl=info msg="Setting loaded" path="this \"thing\" contains quotes"`,
			map[string]string{
				"lvl":  "info",
				"msg":  "Setting loaded",
				"path": `this "thing" contains quotes`,
			},
		},
		{
			`Registered SIF debug handler 1: 'SIF/Button' initial state: 0`,
			nil,
		},
	}
	for ii, tt := range tests {
		t.Run(fmt.Sprint(ii), func(t *testing.T) {
			got := parseSampLoggerToMap(tt.input)
			assert.Equal(t, tt.want, got)
			pretty.Println(got) //nolint:errcheck
		})
	}
}

func Test_splitLine(t *testing.T) {
	tests := []struct {
		line string
		want []string
	}{
		{
			`lvl=info msg="Setting loaded" path="spawn/new-items/1" output="Ammo9mm"`,
			[]string{
				`lvl=info`,
				`msg="Setting loaded"`,
				`path="spawn/new-items/1"`,
				`output="Ammo9mm"`,
			},
		},
	}
	for ii, tt := range tests {
		t.Run(fmt.Sprint(ii), func(t *testing.T) {
			got := splitLine(tt.line)
			pretty.Println(got) //nolint:errcheck
		})
	}
}

{'fraction_non_alphanumeric': 0.18431122448979592, 'fraction_numerical': 0.007653061224489796, 'mean_word_length': 3.3086080586080584, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3703768', 'n_tokens_mistral': 2149, 'n_tokens_neox': 1873, 'n_words': 364}