<commit_before>package main

import (
	"github.com/spf13/cast"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestAutoRepair(t *testing.T) {
	c := newConfig()

	c.EndpointURI = "test-host.localdomain"
	c.AutoRepair()
	assert.Equal(t, "https://test-host.localdomain:"+cast.ToString(c.ServerPort)+"/", c.EndpointURI)

	c.EndpointURI = "test-host.localdomain:8000"
	c.AutoRepair()
	assert.Equal(t, "https://test-host.localdomain:8000/", c.EndpointURI)

	c.EndpointURI = "http://test-host.localdomain:8000/"
	c.AutoRepair()
	assert.Equal(t, "http://test-host.localdomain:8000/", c.EndpointURI)
}

func TestEmptyEndpointUriDuringAutoRepair(t *testing.T) {
	c := newConfig()

	c.EndpointURI = ""
	c.AutoRepair()
	assert.Equal(t, "", c.EndpointURI)
}

func TestHomeWithTrailingSlash(t *testing.T) {
	c := newConfig()
	c.Home = "/tmp/"

	assert.Equal(t,"/tmp",c.GetHome())
}

func TestHomeAsRoot(t *testing.T) {
	c := newConfig()
	c.Home = "/"

	assert.Equal(t,"/",c.GetHome())
}

func TestAutoTag(t *testing.T) {
	c := newConfig()
	c.Hostname =  "cb01.test.localdomain"
	tags := c.GetTags()
	assert.Len(t,tags,2)
	assert.NotContains(t,tags,"cb01")
	assert.NotContains(t,tags,"cb")
	assert.Contains(t, tags, "test")
	assert.Contains(t, tags, "localdomain")
	assert.NotContains(t, tags, "")
}<commit_msg>new test for tags<commit_after>package main

import (
	"github.com/spf13/cast"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestAutoRepair(t *testing.T) {
	c := newConfig()

	c.EndpointURI = "test-host.localdomain"
	c.AutoRepair()
	assert.Equal(t, "https://test-host.localdomain:"+cast.ToString(c.ServerPort)+"/", c.EndpointURI)

	c.EndpointURI = "test-host.localdomain:8000"
	c.AutoRepair()
	assert.Equal(t, "https://test-host.localdomain:8000/", c.EndpointURI)

	c.EndpointURI = "http://test-host.localdomain:8000/"
	c.AutoRepair()
	assert.Equal(t, "http://test-host.localdomain:8000/", c.EndpointURI)
}

func TestEmptyEndpointUriDuringAutoRepair(t *testing.T) {
	c := newConfig()

	c.EndpointURI = ""
	c.AutoRepair()
	assert.Equal(t, "", c.EndpointURI)
}

func TestHomeWithTrailingSlash(t *testing.T) {
	c := newConfig()
	c.Home = "/tmp/"

	assert.Equal(t,"/tmp",c.GetHome())
}

func TestHomeAsRoot(t *testing.T) {
	c := newConfig()
	c.Home = "/"

	assert.Equal(t,"/",c.GetHome())
}

func TestAutoTag(t *testing.T) {
	c := newConfig()
	c.Hostname =  "cb01.test.localdomain"
	tags := c.GetTags()
	assert.Len(t,tags,2)
	assert.NotContains(t,tags,"cb01")
	assert.NotContains(t,tags,"cb")
	assert.Contains(t, tags, "test")
	assert.Contains(t, tags, "localdomain")
	assert.NotContains(t, tags, "")
}

func TestTagsShouldContainsAutoAndRegularTags(t *testing.T) {
	c := newConfig()
	c.TagsList = []string{ "test1", "test2" }
	c.Hostname = "localtest"

	tags := c.GetTags()

	assert.Len(t,tags,3)
	assert.Contains(t, tags, "localtest")
	assert.Contains(t, tags, "test1")
	assert.Contains(t, tags, "test2")
}
{'fraction_non_alphanumeric': 0.19246575342465752, 'fraction_numerical': 0.017465753424657535, 'mean_word_length': 4.901010101010101, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '6028398', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1163, 'n_words': 172}