File: testdata.go

package info (click to toggle)
golang-github-clipperhouse-uax29 2.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 2,392 kB
  • sloc: makefile: 4
file content (24 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package testdata

import (
	"os"
	"path/filepath"
	"runtime"
)

func InvalidUTF8() ([]byte, error) {
	return load("UTF-8-test.txt")
}

func Sample() ([]byte, error) {
	return load("sample.txt")
}

func load(filename string) ([]byte, error) {
	// Get the directory of this source file
	_, currentFile, _, _ := runtime.Caller(0)
	dir := filepath.Dir(currentFile)
	path := filepath.Join(dir, filename)

	return os.ReadFile(path)
}