<commit_before>package wellington

import (
	"fmt"
	"io/ioutil"
	"os"
	"strings"
	"testing"
)

func TestImportPath(t *testing.T) {
	p := NewParser()
	dir, file := "test/sass", "var"
	contents, _ := ioutil.ReadFile("test/sass/_var.scss")
	path, res, err := p.ImportPath(dir, file)

	if err != nil {
		t.Errorf("Error accessing file: %s", file)
	}

	if res != string(contents) {
		t.Errorf("Contents did not match expected:%s\nwas:%s",
			string(contents), res)
	}

	rel := strings.Replace(path, os.Getenv("PWD"), "", 1)
	if e := "/test/sass"; e != rel {
		t.Errorf("Invalid path expected:%s\nwas:%s", e, rel)
	}

	p.Includes = []string{"test"}
	// Is this how it should work?
	// Or should dir be appended to Includes
	dir, file = "test/sass", "var"
	path, res, err = p.ImportPath(dir, file)

	if err != nil {
		t.Errorf("Error accessing file: %s", file)
		t.Error(err)
	}

	if res != string(contents) {
		t.Errorf("Contents did not match expected:%s\nwas:%s",
			string(contents), res)
	}
}

func TestMissingImport(t *testing.T) {
	p := NewParser()
	dir, file := "test", "notafile"
	_, res, err := p.ImportPath(dir, file)
	if res != "" {
		t.Errorf("Result from import on missing file: %s", file)
	}

	rel := strings.Replace(err.Error(), os.Getenv("PWD"), "", 1)
	if e := "Could not import: notafile\nTried:\n" +
		"./\n"; rel != e {
		t.Errorf("Error message invalid\nexpected: %s\nwas: %s",
			e, err.Error())
	}
}

func TestImportSass(t *testing.T) {
	p := NewParser()
	dir, file := "test/whitespace", "one"

	_, res, err := p.ImportPath(dir, file)
	if err != nil {
		t.Fatal(err)
	}
	if res != "" {

	}

	fmt.Println(res)

	// Importer
	//dir, file := "test/whitespace", "import"
}<commit_msg>test for sass2scss<commit_after>package wellington

import (
	"io/ioutil"
	"os"
	"strings"
	"testing"
)

func TestImportPath(t *testing.T) {
	p := NewParser()
	dir, file := "test/sass", "var"
	contents, _ := ioutil.ReadFile("test/sass/_var.scss")
	path, res, err := p.ImportPath(dir, file)

	if err != nil {
		t.Errorf("Error accessing file: %s", file)
	}

	if res != string(contents) {
		t.Errorf("Contents did not match expected:%s\nwas:%s",
			string(contents), res)
	}

	rel := strings.Replace(path, os.Getenv("PWD"), "", 1)
	if e := "/test/sass"; e != rel {
		t.Errorf("Invalid path expected:%s\nwas:%s", e, rel)
	}

	p.Includes = []string{"test"}
	// Is this how it should work?
	// Or should dir be appended to Includes
	dir, file = "test/sass", "var"
	path, res, err = p.ImportPath(dir, file)

	if err != nil {
		t.Errorf("Error accessing file: %s", file)
		t.Error(err)
	}

	if res != string(contents) {
		t.Errorf("Contents did not match expected:%s\nwas:%s",
			string(contents), res)
	}
}

func TestMissingImport(t *testing.T) {
	p := NewParser()
	dir, file := "test", "notafile"
	_, res, err := p.ImportPath(dir, file)
	if res != "" {
		t.Errorf("Result from import on missing file: %s", file)
	}

	rel := strings.Replace(err.Error(), os.Getenv("PWD"), "", 1)
	if e := "Could not import: notafile\nTried:\n" +
		"./\n"; rel != e {
		t.Errorf("Error message invalid\nexpected: %s\nwas: %s",
			e, err.Error())
	}
}

func TestImportSass(t *testing.T) {
	p := NewParser()
	dir, file := "test/whitespace", "one"

	_, res, err := p.ImportPath(dir, file)
	if err != nil {
		t.Fatal(err)
	}
	if res != "" {

	}

	t.Error(res)

	// Importer
	//dir, file := "test/whitespace", "import"
}
{'fraction_non_alphanumeric': 0.19775678866587956, 'fraction_numerical': 0.0014757969303423849, 'mean_word_length': 3.573549257759784, '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': '3571400', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1337, 'n_words': 335}