author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> |
Wed, 27 May 2009 08:39:16 +0200 | |
changeset 1956 | 9865daa96cd7 |
parent 451 | 1261226552ec |
permissions | -rw-r--r-- |
451
1261226552ec
update dependencies in js unit tests
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
1 |
// run tests with the following command line : |
1261226552ec
update dependencies in js unit tests
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
2 |
// $ crosscheck jstest_python.jst |
0 | 3 |
|
4 |
crosscheck.addTest({ |
|
5 |
||
6 |
setup: function() { |
|
7 |
crosscheck.load("testutils.js"); |
|
8 |
crosscheck.load("../data/jquery.js"); |
|
451
1261226552ec
update dependencies in js unit tests
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
9 |
crosscheck.load("../data/cubicweb.compat.js"); |
1261226552ec
update dependencies in js unit tests
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
10 |
crosscheck.load("../data/cubicweb.python.js"); |
0 | 11 |
}, |
12 |
||
13 |
test_basic_number_parsing: function () { |
|
14 |
var d = strptime('2008/08/08', '%Y/%m/%d'); |
|
15 |
assertArrayEquals(datetuple(d), [2008, 8, 8, 0, 0]) |
|
16 |
d = strptime('2008/8/8', '%Y/%m/%d'); |
|
17 |
assertArrayEquals(datetuple(d), [2008, 8, 8, 0, 0]) |
|
18 |
d = strptime('8/8/8', '%Y/%m/%d'); |
|
19 |
assertArrayEquals(datetuple(d), [8, 8, 8, 0, 0]) |
|
20 |
d = strptime('0/8/8', '%Y/%m/%d'); |
|
21 |
assertArrayEquals(datetuple(d), [0, 8, 8, 0, 0]) |
|
22 |
d = strptime('-10/8/8', '%Y/%m/%d'); |
|
23 |
assertArrayEquals(datetuple(d), [-10, 8, 8, 0, 0]) |
|
24 |
d = strptime('-35000', '%Y'); |
|
25 |
assertArrayEquals(datetuple(d), [-35000, 1, 1, 0, 0]) |
|
26 |
}, |
|
27 |
||
28 |
test_custom_format_parsing: function () { |
|
29 |
var d = strptime('2008-08-08', '%Y-%m-%d'); |
|
30 |
assertArrayEquals(datetuple(d), [2008, 8, 8, 0, 0]) |
|
31 |
d = strptime('2008 - ! 08: 08', '%Y - ! %m: %d'); |
|
32 |
assertArrayEquals(datetuple(d), [2008, 8, 8, 0, 0]) |
|
33 |
d = strptime('2008-08-08 12:14', '%Y-%m-%d %H:%M'); |
|
34 |
assertArrayEquals(datetuple(d), [2008, 8, 8, 12, 14]) |
|
35 |
d = strptime('2008-08-08 1:14', '%Y-%m-%d %H:%M'); |
|
36 |
assertArrayEquals(datetuple(d), [2008, 8, 8, 1, 14]) |
|
37 |
d = strptime('2008-08-08 01:14', '%Y-%m-%d %H:%M'); |
|
38 |
assertArrayEquals(datetuple(d), [2008, 8, 8, 1, 14]) |
|
39 |
} |
|
40 |
//, |
|
41 |
// |
|
42 |
// test_gregorian_parsing: function() { |
|
43 |
// var d = parseGregorianDateTime("May 28 0100 09:00:00 GMT"); |
|
44 |
// assertArrayEquals(datetuple(d), [100, 5, 28, 10, 0]); |
|
45 |
// d = parseGregorianDateTime("May 28 0099 09:00:00 GMT"); |
|
46 |
// assertArrayEquals(datetuple(d), [99, 5, 28, 10, 0]); |
|
47 |
// } |
|
48 |
||
49 |
}) |