Importer addSearchPath("../iospec") doFile("../iospec/context.io") doFile("fold.io") context("empty list", setup( e := list ) specify("should foldl/1 to nil", e foldl(+) should be(nil) ) specify("should foldr/1 to nil", e foldr(+) should be(nil) ) specify("should foldl/3 to nil", e foldl(x, y, x + y) should be(nil) ) specify("should foldr/3 to nil", e foldr(x, y, x + y) should be(nil) ) ) context("single elemnt list", setup( value := 42 s := list(value) ) specify("should support one argument foldl", s foldl(-) should be(value) ) specify("should support three argument foldl", s foldl(x, y, x - y) should be(value) ) specify("should support one argument foldr", s foldr(-) should be(value) ) specify("should support three argument foldr", s foldr(x, y, x - y) should be(value) ) ) context("four element list", setup( a := list(6, 2, 1, 9) ) specify("should support one argument foldl", a foldl(-) should be(-6) ) specify("should support three argument foldl", a foldl(x, y, x - y) should be(-6) ) specify("should support one argument foldr", a foldr(-) should be(-4) ) specify("should support three argument foldr", a foldr(x, y, x - y) should be(-4) ) )