<commit_before>#!/usr/bin/env bats

load ../helper

@test 'check and up to date castle' {
	$EXPECT_INSTALLED || skip 'expect not installed'

	castle 'rc-files'
	esc="\\u001b\\u005b"
	cat <<EOF | expect -f -
			spawn $HOMESHICK_BIN check rc-files
			expect -ex "${esc}1;36m     checking${esc}0m rc-files\r${esc}1;32m   up to date${esc}0m rc-files\r\n" {} default {exit 1}
EOF
}

@test 'check an up to date castle with spaces in castle name' {
	$EXPECT_INSTALLED || skip 'expect not installed'

	castle 'repo with spaces in name'
	esc="\\u001b\\u005b"
	cat <<EOF | expect -f -
			spawn $HOMESHICK_BIN check "repo with spaces in name"
			expect -ex "${esc}1;36m     checking${esc}0m repo with spaces in name\r${esc}1;32m   up to date${esc}0m repo with spaces in name\r\n" {} default {exit 1}
EOF
}

@test 'check a castle that is behind upstream' {
	$EXPECT_INSTALLED || skip 'expect not installed'

	castle 'rc-files'
	(cd "$HOMESICK/repos/rc-files"; git reset --hard HEAD^1)
	esc="\\u001b\\u005b"<commit_msg>Fixing typo in test name.<commit_after>#!/usr/bin/env bats

load ../helper

@test 'check an up to date castle' {
	$EXPECT_INSTALLED || skip 'expect not installed'

	castle 'rc-files'
	esc="\\u001b\\u005b"
	cat <<EOF | expect -f -
			spawn $HOMESHICK_BIN check rc-files
			expect -ex "${esc}1;36m     checking${esc}0m rc-files\r${esc}1;32m   up to date${esc}0m rc-files\r\n" {} default {exit 1}
EOF
}

@test 'check an up to date castle with spaces in castle name' {
	$EXPECT_INSTALLED || skip 'expect not installed'

	castle 'repo with spaces in name'
	esc="\\u001b\\u005b"
	cat <<EOF | expect -f -
			spawn $HOMESHICK_BIN check "repo with spaces in name"
			expect -ex "${esc}1;36m     checking${esc}0m repo with spaces in name\r${esc}1;32m   up to date${esc}0m repo with spaces in name\r\n" {} default {exit 1}
EOF
}

@test 'check a castle that is behind upstream' {
	$EXPECT_INSTALLED || skip 'expect not installed'

	castle 'rc-files'
	(cd "$HOMESICK/repos/rc-files"; git reset --hard HEAD^1)
	esc="\\u001b\\u005b"
{'fraction_non_alphanumeric': 0.14483440434997527, 'fraction_numerical': 0.0365793376173999, 'mean_word_length': 3.6422018348623855, 'pattern_counts': {'":': 0, '<': 11, '<?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': '7622935', 'n_tokens_mistral': 819, 'n_tokens_neox': 754, 'n_words': 241}