<commit_before>package main

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

func TestRunCommand(t *testing.T) {
	w := new(bytes.Buffer)
	err := runCommand(`echo -n {{env "USER"}}`, prepareFunc(func(cmd *exec.Cmd) {
		cmd.Stdout = w
	}))
	assert.Nil(t, err)
	assert.Equal(t, os.Getenv("USER"), w.String())
}<commit_msg>add more test<commit_after>package main

import (
	"bytes"
	"fmt"
	"github.com/stretchr/testify/assert"
	"os"
	"os/exec"
	"testing"
)

func TestRunCommand(t *testing.T) {
	w := new(bytes.Buffer)
	err := runCommand(`echo -n {{env "USER"}}`, prepareFunc(func(cmd *exec.Cmd) {
		cmd.Stdout = w
	}))
	assert.Nil(t, err)
	assert.Equal(t, os.Getenv("USER"), w.String())
}

func TestRunComplexCommand(t *testing.T) {
	w := new(bytes.Buffer)
	cmd := `echo -n {{if env "USER"}}--user={{env "USER"}}{{end}}
                {{if env "DO_NOT_MATCH"}}--group={{env "USER"}}{{end}}
                --listen={{ipv4 "127.0"}}:{{env "PORT" "80"}}`
	expected := fmt.Sprintf("--user=%s --listen=127.0.0.1:80", os.Getenv("USER"))

	err := runCommand(cmd, prepareFunc(func(cmd *exec.Cmd) {
		cmd.Stdout = w
	}))
	assert.Nil(t, err)
	assert.Equal(t, expected, w.String())
}
{'fraction_non_alphanumeric': 0.22332506203473945, 'fraction_numerical': 0.01240694789081886, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '1625276', 'n_tokens_mistral': 506, 'n_tokens_neox': 497, 'n_words': 92}