<commit_before>package terminfo

import (
	"testing"
)

// TODO look at unibillium tests
func TestOpen(t *testing.T) {
	ti, err := LoadFromEnv()
	if err != nil {
		t.Fatal(err)
	}
	ti = ti
	//t.Logf("%q", ti.ExtStrings["kUP7"])
	//t.Logf("%q", ti.Strings[FlashScreen])
	//	b := bytes.NewBuffer(nil)
	//	ti.Strings[PadChar] = "*"
	//ti.Puts(b, ti.Strings[FlashScreen], 1, 9600)
	//	t.Logf("%q", b.Bytes())
	//t.Logf("%q", ti.Color(1, 1))
}

/*func BenchmarkParm(b *testing.B) {
	ti, err := LoadFromEnv()
	if err != nil {
		b.Fatal(err)
	}
	var r string
	for i := 0; i < b.N; i++ {
		r = ti.Color(7, 5)
	}
	result = r
}*/<commit_msg>Updating Open test<commit_after>package terminfo

import (
	"os"
	"path/filepath"
	"regexp"
	"testing"
)

var fileRE = regexp.MustCompile("^([0-9]+|[a-zA-Z])/")

func TestOpen(t *testing.T) {
	for _, dir := range []string{"/lib/terminfo", "/usr/share/terminfo"} {
		t.Run(dir[1:], func(dir string) func(*testing.T) {
			return func(t *testing.T) {
				t.Parallel()
				t.Logf("processing dir %s", dir)
				filepath.Walk(dir, func(file string, fi os.FileInfo, err error) error {
					if fi.IsDir() || !fileRE.MatchString(file[len(dir)+1:]) {
						t.Logf("skipping: %s", file)
						return nil
					}

					term := filepath.Base(file)

					t.Logf("opening %s (%s)", file, term)

					// open
					ti, err := Open(dir, term)
					if err != nil {
						t.Fatalf("term %s expected no error, got: %v", term, err)
					}

					if ti.File != file {
						t.Errorf("term %s should have file %s, got: %s", term, file, ti.File)
					}

					// check we have at least one name
					if len(ti.Names) < 1 {
						t.Errorf("term %s expected names to have at least one value", term)
					}
					t.Logf("term %s -- '%s'", term, ti.Names[len(ti.Names)-1])

					return nil
				})
			}
		}(dir))
	}
}
{'fraction_non_alphanumeric': 0.20066152149944874, 'fraction_numerical': 0.009371554575523704, 'mean_word_length': 2.75, 'pattern_counts': {'":': 0, '<': 5, '<?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': '717654', 'n_tokens_mistral': 862, 'n_tokens_neox': 736, 'n_words': 176}