<commit_before>package annot

import (
	"fmt"
	"reflect"
	"testing"
)

func testScanComment(t *testing.T, src string, expect []Comment, expect_err bool) {
	res, err := ScanComment(src)
	fmt.Printf("%q:\n\texpect=%+v\n\tresult=%+v\n\texpect_err=%v\n\terr=%v\n",
		src, expect, res, expect_err, err)

	if (err != nil && !expect_err) || (err == nil && expect_err) {
		t.Errorf("%q: expect_err=%v, err=%v\n", src, expect_err, err)
		return
	}
	if !reflect.DeepEqual(res, expect) {
		t.Errorf("%q: scan failed\n", src)
		return
	}

}

func TestSharp(t *testing.T) {
	fmt.Println("TestSharp")
	testScanComment(t, "# abc ", []Comment{
		Comment{<commit_msg>Change error display in comment_test<commit_after>package annot

import (
	"fmt"
	"reflect"
	"testing"
)

func testScanComment(t *testing.T, src string, expect []Comment, expect_err bool) {
	res, err := ScanComment(src)
	fmt.Printf("%q:\n\texpect=%+v\n\tresult=%+v\n\texpect_err=%v\n\terr=%v\n",
		src, expect, res, expect_err, err)

	if (err != nil && !expect_err) || (err == nil && expect_err) {
		t.Errorf("%q: err != expect_err\n", src)
		return
	}
	if !reflect.DeepEqual(res, expect) {
		t.Errorf("%q: result != expect\n", src)
		return
	}

}

func TestSharp(t *testing.T) {
	fmt.Println("TestSharp")
	testScanComment(t, "# abc ", []Comment{
		Comment{
{'fraction_non_alphanumeric': 0.19204284621270085, 'fraction_numerical': 0.0, 'mean_word_length': 4.518987341772152, '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': '3266892', 'n_tokens_mistral': 542, 'n_tokens_neox': 523, 'n_words': 109}