Skip to content
Back to skills

Test Equal

ASecurity

When testing Either values, compare the value directly with shouldBe instead of checking isLeft, so test failures show the actual value. Use when writing or reviewing Haskell test code that asserts on Either or similar values.

  • 3 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added May 27, 2026
data-aitesting

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add ncaq/konoka --skill test-equal --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Test Equal?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Test Equal
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ncaq-test-equal/badge)](https://www.skillsdirectory.com/skills/ncaq-test-equal)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: test-equal
description: When testing Either values, compare the value directly with shouldBe instead of checking isLeft, so test failures show the actual value. Use when writing or reviewing Haskell test code that asserts on Either or similar values.
user-invocable: false
---

# テストでの値の比較

## Either値をテストするときは値を直接比較する

値`x`をテストするときに、
値`x`が`Either`の値である場合は、
次のように書くのは避けます。

```haskell
isLeft x `shouldBe` True
```

このように書くとテストフレームワーク側に、
実際どのような値が入っていたのかの情報が伝わらないため、
テスト失敗時に情報がなくなってしまいます。

`Either`の値が`Show`と`Eq`のインスタンスである場合は以下のように単純に比較できます。

```haskell
x `shouldBe` Left "expected error"
```

`Eq`のインスタンスでない場合でも、
`isLeft`の結果を`shouldBe`に渡すよりは、
実際の中身の振る舞いを検査できる関数が、
テストフレームワーク側に用意されているはずなので、
それを使うべきです。

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.