mirror of
https://github.com/numtide/treefmt.git
synced 2024-10-27 01:44:13 +03:00
fix: remove config2 alias in format_test.go
It's unnecessary.
This commit is contained in:
parent
53b0dc5536
commit
6c7fd57b5c
@ -9,7 +9,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
config2 "git.numtide.com/numtide/treefmt/config"
|
"git.numtide.com/numtide/treefmt/config"
|
||||||
"git.numtide.com/numtide/treefmt/format"
|
"git.numtide.com/numtide/treefmt/format"
|
||||||
"git.numtide.com/numtide/treefmt/test"
|
"git.numtide.com/numtide/treefmt/test"
|
||||||
|
|
||||||
@ -47,8 +47,8 @@ func TestAllowMissingFormatter(t *testing.T) {
|
|||||||
tempDir := test.TempExamples(t)
|
tempDir := test.TempExamples(t)
|
||||||
configPath := tempDir + "/treefmt.toml"
|
configPath := tempDir + "/treefmt.toml"
|
||||||
|
|
||||||
test.WriteConfig(t, configPath, config2.Config{
|
test.WriteConfig(t, configPath, config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"foo-fmt": {
|
"foo-fmt": {
|
||||||
Command: "foo-fmt",
|
Command: "foo-fmt",
|
||||||
},
|
},
|
||||||
@ -65,8 +65,8 @@ func TestAllowMissingFormatter(t *testing.T) {
|
|||||||
func TestSpecifyingFormatters(t *testing.T) {
|
func TestSpecifyingFormatters(t *testing.T) {
|
||||||
as := require.New(t)
|
as := require.New(t)
|
||||||
|
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"elm": {
|
"elm": {
|
||||||
Command: "touch",
|
Command: "touch",
|
||||||
Options: []string{"-m"},
|
Options: []string{"-m"},
|
||||||
@ -131,8 +131,8 @@ func TestIncludesAndExcludes(t *testing.T) {
|
|||||||
configPath := tempDir + "/touch.toml"
|
configPath := tempDir + "/touch.toml"
|
||||||
|
|
||||||
// test without any excludes
|
// test without any excludes
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"echo": {
|
"echo": {
|
||||||
Command: "echo",
|
Command: "echo",
|
||||||
Includes: []string{"*"},
|
Includes: []string{"*"},
|
||||||
@ -203,8 +203,8 @@ func TestCache(t *testing.T) {
|
|||||||
configPath := tempDir + "/touch.toml"
|
configPath := tempDir + "/touch.toml"
|
||||||
|
|
||||||
// test without any excludes
|
// test without any excludes
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"echo": {
|
"echo": {
|
||||||
Command: "echo",
|
Command: "echo",
|
||||||
Includes: []string{"*"},
|
Includes: []string{"*"},
|
||||||
@ -261,8 +261,8 @@ func TestChangeWorkingDirectory(t *testing.T) {
|
|||||||
configPath := tempDir + "/treefmt.toml"
|
configPath := tempDir + "/treefmt.toml"
|
||||||
|
|
||||||
// test without any excludes
|
// test without any excludes
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"echo": {
|
"echo": {
|
||||||
Command: "echo",
|
Command: "echo",
|
||||||
Includes: []string{"*"},
|
Includes: []string{"*"},
|
||||||
@ -286,8 +286,8 @@ func TestFailOnChange(t *testing.T) {
|
|||||||
configPath := tempDir + "/touch.toml"
|
configPath := tempDir + "/touch.toml"
|
||||||
|
|
||||||
// test without any excludes
|
// test without any excludes
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"touch": {
|
"touch": {
|
||||||
Command: "touch",
|
Command: "touch",
|
||||||
Includes: []string{"*"},
|
Includes: []string{"*"},
|
||||||
@ -322,8 +322,8 @@ func TestBustCacheOnFormatterChange(t *testing.T) {
|
|||||||
as.NoError(os.Setenv("PATH", binPath+":"+os.Getenv("PATH")))
|
as.NoError(os.Setenv("PATH", binPath+":"+os.Getenv("PATH")))
|
||||||
|
|
||||||
// start with 2 formatters
|
// start with 2 formatters
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"python": {
|
"python": {
|
||||||
Command: "black",
|
Command: "black",
|
||||||
Includes: []string{"*.py"},
|
Includes: []string{"*.py"},
|
||||||
@ -367,7 +367,7 @@ func TestBustCacheOnFormatterChange(t *testing.T) {
|
|||||||
assertStats(t, as, 31, 0, 0, 0)
|
assertStats(t, as, 31, 0, 0, 0)
|
||||||
|
|
||||||
// add go formatter
|
// add go formatter
|
||||||
cfg.Formatters["go"] = &config2.Formatter{
|
cfg.Formatters["go"] = &config.Formatter{
|
||||||
Command: "gofmt",
|
Command: "gofmt",
|
||||||
Options: []string{"-w"},
|
Options: []string{"-w"},
|
||||||
Includes: []string{"*.go"},
|
Includes: []string{"*.go"},
|
||||||
@ -417,8 +417,8 @@ func TestGitWorktree(t *testing.T) {
|
|||||||
configPath := filepath.Join(tempDir, "/treefmt.toml")
|
configPath := filepath.Join(tempDir, "/treefmt.toml")
|
||||||
|
|
||||||
// basic config
|
// basic config
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"echo": {
|
"echo": {
|
||||||
Command: "echo",
|
Command: "echo",
|
||||||
Includes: []string{"*"},
|
Includes: []string{"*"},
|
||||||
@ -484,8 +484,8 @@ func TestPathsArg(t *testing.T) {
|
|||||||
as.NoError(os.Chdir(tempDir))
|
as.NoError(os.Chdir(tempDir))
|
||||||
|
|
||||||
// basic config
|
// basic config
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"echo": {
|
"echo": {
|
||||||
Command: "echo",
|
Command: "echo",
|
||||||
Includes: []string{"*"},
|
Includes: []string{"*"},
|
||||||
@ -528,8 +528,8 @@ func TestStdIn(t *testing.T) {
|
|||||||
as.NoError(os.Chdir(tempDir))
|
as.NoError(os.Chdir(tempDir))
|
||||||
|
|
||||||
// basic config
|
// basic config
|
||||||
cfg := config2.Config{
|
cfg := config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
"echo": {
|
"echo": {
|
||||||
Command: "echo",
|
Command: "echo",
|
||||||
Includes: []string{"*"},
|
Includes: []string{"*"},
|
||||||
@ -571,8 +571,8 @@ func TestDeterministicOrderingInPipeline(t *testing.T) {
|
|||||||
tempDir := test.TempExamples(t)
|
tempDir := test.TempExamples(t)
|
||||||
configPath := tempDir + "/treefmt.toml"
|
configPath := tempDir + "/treefmt.toml"
|
||||||
|
|
||||||
test.WriteConfig(t, configPath, config2.Config{
|
test.WriteConfig(t, configPath, config.Config{
|
||||||
Formatters: map[string]*config2.Formatter{
|
Formatters: map[string]*config.Formatter{
|
||||||
// a and b have no priority set, which means they default to 0 and should execute first
|
// a and b have no priority set, which means they default to 0 and should execute first
|
||||||
// a and b should execute in lexicographical order
|
// a and b should execute in lexicographical order
|
||||||
// c should execute first since it has a priority of 1
|
// c should execute first since it has a priority of 1
|
||||||
|
Loading…
Reference in New Issue
Block a user