From 9e627bd5a88b41254fc10955f7def21fa1f329fc Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 24 Jul 2012 19:49:50 -0400 Subject: Fix JavaScript implementation of strcspn() --- lib/js/urweb.js | 2 +- tests/strcspn.ur | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/strcspn.ur diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 4435bffa..56066d26 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -1104,7 +1104,7 @@ function sspn(s, chs) { if (chs.indexOf(s.charAt(i)) != -1) return i; - return null; + return s.length; } function schr(s, ch) { var r = s.indexOf(ch); diff --git a/tests/strcspn.ur b/tests/strcspn.ur new file mode 100644 index 00000000..8066010b --- /dev/null +++ b/tests/strcspn.ur @@ -0,0 +1,6 @@ +fun main () : transaction page = + s <- source ""; + return + +