soma.cell

E0095: empty_test_cell

E0095 empty_test_cell — a test cell that asserts nothing.

A compile-time error of soma check, the checker of the Soma programming language (soma explain E0095).

The rule

A cell test that has no rules { } block, only helpers, would run zero assertions and report success, so soma check refuses it with E0095. Helpers inside a test cell (on _totals_add_up()) never run on their own: only assert, assert_fails and property lines are tests. Add a rules block that asserts on the helper's result.

A program that triggers it

wrong.cell

cell Cart {
    face {
        signal total(prices: List<Int>) -> Int
    }
    on total(prices: List<Int>) {
        return sum(prices)
    }
}

cell test CartTests {
    on _totals_add_up() {
        return total([250, 100]) == 350 && total([]) == 0
    }
}

What soma check prints:

$ soma check wrong.cell
error: test cell 'CartTests' has no `rules { }` block — it would run zero assertions and pass
  --> wrong.cell:10:1
   |
10 | cell test CartTests {
   | ^
  = code: E0095
✗ 1 error(s), 0 warning(s).

The fix field of soma check --json: it would run zero assertions and pass

3 lines are added after line 13.

wrong.cell → right.cell

--- wrong.cell
+++ right.cell
@@ -12,3 +12,6 @@
         return total([250, 100]) == 350 && total([]) == 0
     }
+    rules {
+        assert _totals_add_up()
+    }
 }

With the fix, soma check accepts the program:

$ soma check right.cell
✓ All checks passed.