From 4b7abfa71ffe251ff0a9567af7986d5a31c0645d Mon Sep 17 00:00:00 2001 From: dblock Date: Fri, 13 Jan 2017 07:51:35 -0500 Subject: [PATCH] Test for incorrect cartesian product. --- test/index.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/index.js b/test/index.js index 2e905b3..42b3efc 100644 --- a/test/index.js +++ b/test/index.js @@ -55,7 +55,7 @@ test('exhaustive vs non-exhaustive expansion', function (t) { var slots = { "MOVIE": "LITERAL" }; var template = "{foo|bar|baz} {foo|bar|baz} {movie_names|MOVIE}"; var result = utterances(template, slots, dictionary); - t.deepEqual(result, [ + t.deepEqual(result, [ "foo foo {star wars|MOVIE}", "bar foo {inception|MOVIE}", "baz foo {gattaca|MOVIE}", @@ -68,7 +68,7 @@ test('exhaustive vs non-exhaustive expansion', function (t) { ]); var result2 = utterances(template, slots, dictionary, true); - t.deepEqual(result2, [ + t.deepEqual(result2, [ "foo foo {star wars|MOVIE}", "bar foo {star wars|MOVIE}", "baz foo {star wars|MOVIE}", @@ -123,3 +123,17 @@ test('raw curly braces for custom slot types', function (t) { ]); t.end(); }); + +test('cartesian product', function (t) { + var dictionary = {} + var slots = { "number": "NUMBER" }; + var template = "{to |}set temperature to {1-2|number}"; + var result = utterances(template, slots, dictionary); + t.deepEqual(result, [ + "to set temperature to {one|number}", + "set temperature to {one|number}", + "to set temperature to {two|number}", + "set temperature to {two|number}" + ]); + t.end(); +});