]> gitweb.factorcode.org Git - factor.git/blobdiff - contrib/furnace/test/responder.factor
Working on furnace
[factor.git] / contrib / furnace / test / responder.factor
index 1ae0a4f1eb7cb13e2b3c2e79ec56d37b7278ea9d..d451be502448765abf1f0e2b5c42c5fa7f75acce 100644 (file)
@@ -1,9 +1,26 @@
 IN: temporary
-USING: test namespaces furnace ;
+USING: test namespaces furnace math kernel sequences ;
+
+TUPLE: test-tuple m n ;
+
+[ H{ { "m" 3 } { "n" 2 } } ]
+[
+    [ T{ test-tuple f 3 2 } explode-tuple ] make-hash
+] unit-test
+
+[
+    { 3 }
+] [
+    H{ { "n" "3" } } { { "n" v-number } }
+    [ action-param drop ] map-with
+] unit-test
 
 : foo ;
 
-\ foo { { "foo" "2" } { "bar" f } } define-action
+\ foo { { "foo" "2" v-default } { "bar" v-required } } define-action
+
+[ t ] [ [ 1 2 foo ] action-call? ] unit-test
+[ f ] [ [ 2 + ] action-call? ] unit-test
 
 [
     { "2" "hello" }
@@ -11,9 +28,7 @@ USING: test namespaces furnace ;
     [
         H{
             { "bar" "hello" }
-        } "query" set
-
-        \ foo query>quot
+        } \ foo query>quot
     ] with-scope
 ] unit-test