<commit_before>// These will all be very flaky because they are dependent on actual
// filesystems.
package main

import (
	"crypto/rand"
	"io/ioutil"
	"os"
	"path/filepath"
	"testing"
	"time"
)

const waitForMsg = 2 * time.Second

// Slow in the success case
func TestNoWatchingCreation(t *testing.T) {
	fs := newFS(t)
	fs.Create("foobar")
	ch := make(chan time.Time, 10)
	cleanUp := watchTest(fs, []string{fs.Abs("foobar")}, []string{}, ch)
	defer cleanUp()
	fs.Create("baz")
	seeNothing(fs, ch, "creation of baz")
}

// Slow in the success case
func TestSimpleWatch(t *testing.T) {
	fs := newFS(t)
	fs.Create("foobar")
	ch := make(chan time.Time, 10)
	cleanUp := watchTest(fs, []string{fs.Abs("foobar")}, []string{fs.Abs("baz")}, ch)
	defer cleanUp()
	fs.ChangeContents("foobar")
	seeChangeContents(fs, ch, "foobar")
	fs.Create("baz")
	seeNothing(fs, ch, "creation of baz")
}

func TestSimpleDirWatch(t *testing.T) {
	fs := newFS(t)
	fs.MkdirAll("dir1")
	ch := make(chan time.Time, 10)
	cleanUp := watchTest(fs, []string{fs.Abs("dir1")}, []string{}, ch)
	defer cleanUp()
	fs.Create("dir1/foobar")
	seeCreation(fs, ch, "dir1/foobar")
}

func TestCurrentDirWorks(t *testing.T) {
	fs := newFS(t)
	fs.Create("foobar")
	ch := make(chan time.Time, 10)
	cleanUp := watchTest(fs, []string{fs.Abs(".")}, nil, ch)<commit_msg>rename some test dirs for niceness<commit_after>// These will all be very flaky because they are dependent on actual
// filesystems.
package main

import (
	"crypto/rand"
	"io/ioutil"
	"os"
	"path/filepath"
	"testing"
	"time"
)

const waitForMsg = 2 * time.Second

// Slow in the success case
func TestNoWatchingCreation(t *testing.T) {
	fs := newFS(t)
	fs.Create("foobar")
	ch := make(chan time.Time, 10)
	cleanUp := watchTest(fs, []string{fs.Abs("foobar")}, []string{}, ch)
	defer cleanUp()
	fs.Create("baz")
	seeNothing(fs, ch, "creation of baz")
}

// Slow in the success case
func TestSimpleWatch(t *testing.T) {
	fs := newFS(t)
	fs.Create("foobar")
	ch := make(chan time.Time, 10)
	cleanUp := watchTest(fs, []string{fs.Abs("foobar")}, []string{fs.Abs("baz")}, ch)
	defer cleanUp()
	fs.ChangeContents("foobar")
	seeChangeContents(fs, ch, "foobar")
	fs.Create("baz")
	seeNothing(fs, ch, "creation of baz")
}

func TestSimpleDirWatch(t *testing.T) {
	fs := newFS(t)
	fs.MkdirAll("simpleDir1")
	ch := make(chan time.Time, 10)
	cleanUp := watchTest(fs, []string{fs.Abs("simpleDir1")}, []string{}, ch)
	defer cleanUp()

	fs.Create("simpleDir1/foobar")
	seeCreation(fs, ch, "simpleDir1/foobar")
}

func TestCurrentDirWorks(t *testing.T) {
	fs := newFS(t)
	fs.Create("foobar")
	ch := make(chan time.Time, 10)
	cleanUp := watchTest(fs, []string{fs.Abs(".")}, nil, ch)
{'fraction_non_alphanumeric': 0.18568232662192394, 'fraction_numerical': 0.009694258016405667, 'mean_word_length': 4.896703296703297, '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': '4961518', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1047, 'n_words': 250}