2 USING: kernel sequences tools.test validators accessors
5 [ "" v-one-line ] must-fail
6 [ "hello world" ] [ "hello world" v-one-line ] unit-test
7 [ "hello\nworld" v-one-line ] must-fail
9 [ "" v-one-word ] must-fail
10 [ "hello" ] [ "hello" v-one-word ] unit-test
11 [ "hello world" v-one-word ] must-fail
13 [ t ] [ "on" v-checkbox ] unit-test
14 [ f ] [ "off" v-checkbox ] unit-test
16 [ "foo" v-number ] must-fail
17 [ 123 ] [ "123" v-number ] unit-test
18 [ 123 ] [ "123" v-integer ] unit-test
20 [ "1.0" v-integer ] [ "must be an integer" = ] must-fail-with
22 [ "slava@factorcode.org" ] [
23 "slava@factorcode.org" v-email
26 [ "slava+foo@factorcode.org" ] [
27 "slava+foo@factorcode.org" v-email
30 [ "slava@factorcode.o" v-email ]
31 [ "invalid e-mail" = ] must-fail-with
33 [ "sla@@factorcode.o" v-email ]
34 [ "invalid e-mail" = ] must-fail-with
36 [ "slava@factorcodeorg" v-email ]
37 [ "invalid e-mail" = ] must-fail-with
39 [ "http://www.factorcode.org" ]
40 [ "http://www.factorcode.org" v-url ] unit-test
42 [ "http:/www.factorcode.org" v-url ]
43 [ "invalid URL" = ] must-fail-with
45 [ 4561261212345467 ] [ "4561261212345467" v-credit-card ] unit-test
47 [ 4561261212345467 ] [ "4561-2612-1234-5467" v-credit-card ] unit-test
49 [ 0 ] [ "0000000000000000" v-credit-card ] unit-test
51 [ "000000000" v-credit-card ] must-fail
53 [ "0000000000000000000000000" v-credit-card ] must-fail
55 [ "4561_2612_1234_5467" v-credit-card ] must-fail
57 [ "4561-2621-1234-5467" v-credit-card ] must-fail
59 [ t ] [ "http://double.co.nz/w?v=foo" dup v-url = ] unit-test