<commit_before>package accessor

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestParsePath(t *testing.T) {
	type Input struct {
		Path string
	}
	type Expect struct {
		Path Path
		Err  error
	}
	type Test struct {
		Title  string
		Input  Input
		Expect Expect
	}

	table := []Test{
		Test{
			Title: "basic",
			Input: Input{
				Path: "a/b/0",
			},
			Expect: Expect{
				Path: &basicPath{"a", &basicPath{"b", &basicPath{"0", nil}}},
				Err:  nil,
			},
		},
		Test{
			Title: "slash",
			Input: Input{
				Path: "/a/b/0/",
			},
			Expect: Expect{
				Path: &basicPath{"a", &basicPath{"b", &basicPath{"0", nil}}},
				Err:  nil,
			},
		},
		Test{
			Title: "empty",
			Input: Input{
				Path: "",<commit_msg>Add test of ParsePath for /<commit_after>package accessor

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestParsePath(t *testing.T) {
	type Input struct {
		Path string
	}
	type Expect struct {
		Path Path
		Err  error
	}
	type Test struct {
		Title  string
		Input  Input
		Expect Expect
	}

	table := []Test{
		Test{
			Title: "basic",
			Input: Input{
				Path: "a/b/0",
			},
			Expect: Expect{
				Path: &basicPath{"a", &basicPath{"b", &basicPath{"0", nil}}},
				Err:  nil,
			},
		},
		Test{
			Title: "many slash",
			Input: Input{
				Path: "/a/b/0/",
			},
			Expect: Expect{
				Path: &basicPath{"a", &basicPath{"b", &basicPath{"0", nil}}},
				Err:  nil,
			},
		},
		Test{
			Title: "only slash",
			Input: Input{
				Path: "/",
			},
			Expect: Expect{
				Path: nil,
				Err:  NewInvalidPathError("/"),
			},
		},
		Test{
			Title: "empty",
			Input: Input{
				Path: "",
{'fraction_non_alphanumeric': 0.17396593673965938, 'fraction_numerical': 0.004866180048661801, 'mean_word_length': 2.599562363238512, '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': '4387143', 'n_tokens_mistral': 771, 'n_tokens_neox': 631, 'n_words': 157}