<commit_before>// Copyright (C) 2015 <NAME>.
//
// Licensed onder the MIT license that can be found in the LICENSE file.

package ini

import (
	"errors"
	"testing"
)

func TestNewSynthaxError(t *testing.T) {
	t.Parallel()
	err := newSynthaxError(1, "error message")

	expected := "ini: synthax error on line 1: error message"
	if err.Error() != expected {
		t.Fatalf("Expected the synthax error to be %q, but got %q",
			expected, err.Error())
	}

	if !IsSynthaxError(err) {
		t.Fatal("Expected the synthax error to be a synthax error, but it isn't")
	}
}

func TestIsSynthaxError(t *testing.T) {
	t.Parallel()
	if got := IsSynthaxError(errors.New("some error")); got != false {
		t.Fatalf("Expected synthax error to return false on regular errors")
	}

	got := IsSynthaxError(newSynthaxError(1, "error message"))
	if got != true {
		t.Fatalf("Expected synthax error to return true on synthax errors")
	}
}

func TestCreateOverflowError(t *testing.T) {
	t.Parallel()
	err := createOverflowError("5000", "int8")
	expected := `ini: can't convert "5000" to type int8, it overflows type int8`
	if err.Error() != expected {
		t.Fatalf("Expected the error message error to be %q, but got %q",
			expected, err.Error())
	}
}

func TestCreateConvertError(t *testing.T) {
	t.Parallel()
	err := createConvertError("string", "int8")
	expected := `ini: can't convert "string" to type int8`
	if err.Error() != expected {
		t.Fatalf("Expected the error message error to be %q, but got %q",
			expected, err.Error())
	}
}<commit_msg>Improve testing code<commit_after>// Copyright (C) 2015 <NAME>.
//
// Licensed onder the MIT license that can be found in the LICENSE file.

package ini

import (
	"errors"
	"testing"
)

func TestNewSynthaxError(t *testing.T) {
	t.Parallel()
	err := newSynthaxError(1, "error message")

	expected := "ini: synthax error on line 1: error message"
	if err.Error() != expected {
		t.Fatalf("Expected the synthax error to be %q, but got %q",
			expected, err.Error())
	}

	if !IsSynthaxError(err) {
		t.Fatal("Expected the synthax error to be a synthax error, but it isn't")
	}
}

func TestIsSynthaxError(t *testing.T) {
	t.Parallel()
	regularError := errors.New("some error")
	if got := IsSynthaxError(regularError); got != false {
		t.Fatalf("Expected IsSynthaxError(%v) to return false", regularError)
	}

	synthaxError := newSynthaxError(1, "error message")
	if got := IsSynthaxError(synthaxError); got != true {
		t.Fatalf("Expected IsSynthaxError(%v) to return true", synthaxError)
	}
}

func TestCreateOverflowError(t *testing.T) {
	t.Parallel()
	err := createOverflowError("5000", "int8")
	expected := `ini: can't convert "5000" to type int8, it overflows type int8`
	if err.Error() != expected {
		t.Fatalf("Expected the error message error to be %q, but got %q",
			expected, err.Error())
	}
}

func TestCreateConvertError(t *testing.T) {
	t.Parallel()
	err := createConvertError("string", "int8")
	expected := `ini: can't convert "string" to type int8`
	if err.Error() != expected {
		t.Fatalf("Expected the error message error to be %q, but got %q",
			expected, err.Error())
	}
}
{'fraction_non_alphanumeric': 0.1419375603476022, 'fraction_numerical': 0.012874155133569359, 'mean_word_length': 4.321917808219178, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2585716', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1072, 'n_words': 340}