<commit_before>// Copyright 2015 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package commands

import (
	"bytes"
	"reflect"
	"testing"

	"github.com/garyburd/neovim-go/vim"
)

var minUpdateTests = []struct {
	in  string
	out string
}{
	{"", ""},
	{"a", "a"},
	{"a/b/c", "a/b/c"},<commit_msg>test/fmt: Add test for Fmt function<commit_after>// Copyright 2016 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package commands

import (
	"bytes"
	"os"
	"path/filepath"
	"reflect"
	"testing"

	"github.com/garyburd/neovim-go/vim"
)

func TestFmt(t *testing.T) {
	tests := []struct {
		// Parameters.
		v   *vim.Vim
		dir string
		// Expected results.
		wantErr bool
	}{
		{
			v:       testVim(t, filepath.Join(astdump, "astdump.go")), // correct file
			dir:     astdump,
			wantErr: false,
		},
		{
			v:       testVim(t, filepath.Join(broken, "broken.go")), // broken file
			dir:     broken,
			wantErr: true,
		},
		{
			v:       testVim(t, filepath.Join(gsftp, "src", "cmd", "gsftp", "main.go")), // broken file
			dir:     filepath.Join(gsftp, "src", "cmd", "gsftp"),
			wantErr: false,
		},
	}
	for _, tt := range tests {
		stat, err := os.Stat(tt.dir)
		if err != nil {
			t.Error(err)
		}
		err = Fmt(tt.v, tt.dir)
		t.Logf("%v", err)
		if (err != nil) != tt.wantErr && !stat.IsDir() {
			t.Errorf("Fmt(%v, %v) error = %v, wantErr %v", tt.v, tt.dir, err, tt.wantErr)
		}
	}
}

var minUpdateTests = []struct {
	in  string
	out string
}{
	{"", ""},
	{"a", "a"},
	{"a/b/c", "a/b/c"},
{'fraction_non_alphanumeric': 0.1860325105358218, 'fraction_numerical': 0.00481637567730283, 'mean_word_length': 2.820689655172414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3846335', 'n_tokens_mistral': 726, 'n_tokens_neox': 663, 'n_words': 175}