<commit_before>package cnt

import (
	"os"
	"testing"
)

var (
	testDir, gopath, cntdPath string
)

func init() {
	gopath = os.Getenv("GOPATH")

	if gopath == "" {
		panic("Please, run tests from inside GOPATH")
	}

	testDir = gopath + "/src/github.com/tiago4orion/cnt/" + "testfiles"
	cntdPath = gopath + "/src/github.com/tiago4orion/cnt/cmd/cnt/cnt"

	if _, err := os.Stat(cntdPath); err != nil {
		panic("Please, run make build before running tests")
	}
}

func TestExecute(t *testing.T) {
	testfile := testDir + "/ex1.cnt"

	sh := NewShell(false)
	sh.SetCntdPath(cntdPath)

	err := sh.Execute(testfile)

	if err != nil {
		t.Error(err)
		return
	}
}

func TestExecuteRfork(t *testing.T) {
	sh := NewShell(false)
	sh.SetCntdPath(cntdPath)

	err := sh.ExecuteString("rfork test", `
        rfork u {
            id -u
        }
        `)

	if err != nil {
		t.Error(err)
	}
}

func TestExecuteAssignment(t *testing.T) {
	sh := NewShell(false)
	sh.SetCntdPath(cntdPath)

	err := sh.ExecuteString("assignment", `
        name=i4k
        echo $name
        echo $path
        `)

	if err != nil {
		t.Error(err)
		return
	}
}
<commit_msg>Improve unit tests for list assignment<commit_after>package cnt

import (
	"os"
	"testing"
)

var (
	testDir, gopath, cntdPath string
)

func init() {
	gopath = os.Getenv("GOPATH")

	if gopath == "" {
		panic("Please, run tests from inside GOPATH")
	}

	testDir = gopath + "/src/github.com/tiago4orion/cnt/" + "testfiles"
	cntdPath = gopath + "/src/github.com/tiago4orion/cnt/cmd/cnt/cnt"

	if _, err := os.Stat(cntdPath); err != nil {
		panic("Please, run make build before running tests")
	}
}

func TestExecute(t *testing.T) {
	testfile := testDir + "/ex1.cnt"

	sh := NewShell(false)
	sh.SetCntdPath(cntdPath)

	err := sh.Execute(testfile)

	if err != nil {
		t.Error(err)
		return
	}
}

func TestExecuteRfork(t *testing.T) {
	sh := NewShell(false)
	sh.SetCntdPath(cntdPath)

	err := sh.ExecuteString("rfork test", `
        rfork u {
            id -u
        }
        `)

	if err != nil {
		t.Error(err)
	}
}

func TestExecuteAssignment(t *testing.T) {
	sh := NewShell(false)
	sh.SetCntdPath(cntdPath)

	err := sh.ExecuteString("assignment", `
        name=i4k
        echo $name
        echo $path
        `)

	if err != nil {
		t.Error(err)
		return
	}

	err = sh.ExecuteString("list assignment", `
        name=(honda civic)
        echo $name
        `)

	if err != nil {
		t.Error(err)
		return
	}
}

{'fraction_non_alphanumeric': 0.14932680538555693, 'fraction_numerical': 0.0032639738882088943, 'mean_word_length': 2.754977029096478, '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': '1616119', 'n_tokens_mistral': 1006, 'n_tokens_neox': 960, 'n_words': 201}