<commit_before>package config

import (
	"testing"

	"os"

	. "github.com/smartystreets/goconvey/convey"
)

func TestParse(t *testing.T) {
	Convey("Verify if get default value", t, func() {
		viperCfg()
		cfg := &Prest{}
		err := Parse(cfg)
		So(err, ShouldBeNil)
		So(cfg.HTTPPort, ShouldEqual, 3000)
	})
	Convey("Verify if get env", t, func() {
		os.Setenv("PREST_HTTP_PORT", "4000")
		viperCfg()
		cfg := &Prest{}
		err := Parse(cfg)
		So(err, ShouldBeNil)
		So(cfg.HTTPPort, ShouldEqual, 4000)
	})
	Convey("Verify if get toml", t, func() {
		os.Setenv("PREST_CONF", "../testdata/prest.toml")
		viperCfg()
		cfg := &Prest{}
		err := Parse(cfg)
		So(err, ShouldBeNil)
		So(cfg.HTTPPort, ShouldEqual, 6000)
		So(cfg.PGDatabase, ShouldEqual, "prest")
	})
	Convey("Verify if env override toml", t, func() {
		os.Setenv("PREST_HTTP_PORT", "4000")
		os.Setenv("PREST_CONF", "../testdata/prest.toml")
		viperCfg()
		cfg := &Prest{}
		err := Parse(cfg)
		So(err, ShouldBeNil)
		So(cfg.HTTPPort, ShouldEqual, 4000)
	})
}<commit_msg>fix file path in test<commit_after>package config

import (
	"testing"

	"os"

	. "github.com/smartystreets/goconvey/convey"
)

func TestParse(t *testing.T) {
	Convey("Verify if get default value", t, func() {
		viperCfg()
		cfg := &Prest{}
		err := Parse(cfg)
		So(err, ShouldBeNil)
		So(cfg.HTTPPort, ShouldEqual, 3000)
	})
	Convey("Verify if get env", t, func() {
		os.Setenv("PREST_HTTP_PORT", "4000")
		viperCfg()
		cfg := &Prest{}
		err := Parse(cfg)
		So(err, ShouldBeNil)
		So(cfg.HTTPPort, ShouldEqual, 4000)
	})
	Convey("Verify if get toml", t, func() {
		os.Setenv("PREST_CONF", "testdata/prest.toml")
		viperCfg()
		cfg := &Prest{}
		err := Parse(cfg)
		So(err, ShouldBeNil)
		So(cfg.HTTPPort, ShouldEqual, 6000)
		So(cfg.PGDatabase, ShouldEqual, "prest")
	})
	Convey("Verify if env override toml", t, func() {
		os.Setenv("PREST_HTTP_PORT", "4000")
		os.Setenv("PREST_CONF", "testdata/prest.toml")
		viperCfg()
		cfg := &Prest{}
		err := Parse(cfg)
		So(err, ShouldBeNil)
		So(cfg.HTTPPort, ShouldEqual, 4000)
	})
}
{'fraction_non_alphanumeric': 0.17916260954235638, 'fraction_numerical': 0.023369036027263874, 'mean_word_length': 4.255754475703325, 'pattern_counts': {'":': 0, '<': 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': '3909367', 'n_tokens_mistral': 933, 'n_tokens_neox': 859, 'n_words': 176}