main
1package spec
2
3import (
4 "testing"
5)
6
7func TestCalculator(t *testing.T) {
8 t.Run("when adding 1 + 1", func(t *testing.T) {
9 Establish(func(x *Context) {
10 x.Because(func() { x.Set("result", 1+1).Set("2+2", 2+2) })
11
12 x.It(func() {
13 result := x.Get("result").(int)
14 if result != 2 {
15 t.Errorf("Expected: 2, Got: %d", result)
16 }
17 })
18 })
19 })
20}