<commit_before>package testhelpers

import(
	. "github.com/onsi/gomega"
	"bytes"
  "io"
	"os"
  "strings"
  "wall_street"
)

func SimulatePipes(reader *wall_street.ReadlineReader, input string, block func()) []string {
	in, out, err := os.Pipe()
	Expect(err).NotTo(HaveOccurred())
	reader.SetReadPipe(in)

	go func() {
		defer out.Close()
		out.Write([]byte(input))
	}()

	return CaptureSTDOUT(reader, func() { block() })
}

func CaptureSTDOUT(reader *wall_street.ReadlineReader, block func()) []string {
	in, out, err := os.Pipe()<commit_msg>Add convenient newline to test helpers<commit_after>package testhelpers

import(
	. "github.com/onsi/gomega"
	"bytes"
  "io"
	"os"
  "strings"
  "wall_street"
)

func SimulatePipes(reader *wall_street.ReadlineReader, input string, block func()) []string {
	in, out, err := os.Pipe()
	Expect(err).NotTo(HaveOccurred())
	reader.SetReadPipe(in)

	go func() {
		defer out.Close()
		out.Write([]byte(input + "\n"))
	}()

	return CaptureSTDOUT(reader, func() { block() })
}

func CaptureSTDOUT(reader *wall_street.ReadlineReader, block func()) []string {
	in, out, err := os.Pipe()
{'fraction_non_alphanumeric': 0.16815742397137745, 'fraction_numerical': 0.0, 'mean_word_length': 4.983957219251337, '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': '6471387', 'n_tokens_mistral': 439, 'n_tokens_neox': 420, 'n_words': 89}