<commit_before>package exc

import (
	"testing"

	"github.com/elves/elvish/pkg/eval"
)

var That = eval.That

func TestExc(t *testing.T) {
	setup := func(ev *eval.Evaler) { ev.Global.AddNs("exc", Ns) }
	eval.TestWithSetup(t, setup,
		// Have a simple sanity test that exc:show writes something.
		That(`exc:show ?(fail foo) | > (count (slurp)) 0`).Puts(true),

		That("exc:is-external-cmd-exc ?("+failingExternalCmd+")").Puts(true),
		That("exc:is-external-cmd-exc ?(fail bad)").Puts(false),

		That("exc:is-nonzero-exit ?("+failingExternalCmd+")").Puts(true),
		That("exc:is-nonzero-exit ?(fail bad)").Puts(false),

		// TODO: Test positive case of exc:is-killed
		That("exc:is-killed ?(fail bad)").Puts(false),

		That("exc:is-fail-exc ?(fail bad)").Puts(true),
		That("exc:is-fail-exc ?("+failingExternalCmd+")").Puts(false),
	)
}<commit_msg>pkg/eval/exc: Add missing unit tests for exc:is-pipeline-exc.<commit_after>package exc

import (
	"testing"

	"github.com/elves/elvish/pkg/eval"
)

var That = eval.That

func TestExc(t *testing.T) {
	setup := func(ev *eval.Evaler) { ev.Global.AddNs("exc", Ns) }
	eval.TestWithSetup(t, setup,
		// Have a simple sanity test that exc:show writes something.
		That(`exc:show ?(fail foo) | > (count (slurp)) 0`).Puts(true),

		That("exc:is-external-cmd-exc ?("+failingExternalCmd+")").Puts(true),
		That("exc:is-external-cmd-exc ?(fail bad)").Puts(false),

		That("exc:is-nonzero-exit ?("+failingExternalCmd+")").Puts(true),
		That("exc:is-nonzero-exit ?(fail bad)").Puts(false),

		// TODO: Test positive case of exc:is-killed
		That("exc:is-killed ?(fail bad)").Puts(false),

		That("exc:is-fail-exc ?(fail bad)").Puts(true),
		That("exc:is-fail-exc ?("+failingExternalCmd+")").Puts(false),

		That("exc:is-pipeline-exc ?(fail bad)").Puts(false),
		That("exc:is-pipeline-exc ?(fail 1 | fail 2)").Puts(true),
	)
}
{'fraction_non_alphanumeric': 0.21347708894878706, 'fraction_numerical': 0.00215633423180593, 'mean_word_length': 4.8734177215189876, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5685677', 'n_tokens_mistral': 774, 'n_tokens_neox': 734, 'n_words': 128}