aboutsummaryrefslogtreecommitdiff
path: root/testing/resources/javascript/util_scand.in
blob: 25462d0817968dd700e33e70e56bda04d2fa9962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{{header}}
{{object 1 0}} <<
  /Type /Catalog
  /Pages 2 0 R
  /OpenAction 10 0 R
>>
endobj
{{object 2 0}} <<
  /Type /Pages
  /Count 1
  /Kids [
    3 0 R
  ]
>>
endobj
% Page number 0.
{{object 3 0}} <<
  /Type /Page
  /Parent 2 0 R
  /MediaBox [0 0 612 792]
>>
endobj
% OpenAction action
{{object 10 0}} <<
  /Type /Action
  /S /JavaScript
  /JS 11 0 R
>>
endobj
% JS program to exexute
{{object 11 0}} <<
  {{streamlen}}
>>
stream
{{include expect.js}}

try {
  const tuesday = "Tue, 20 Dec 2016 21:48:50 GMT";
  const friday = "Fri, 09 May 2014 11:22:03 GMT";
  expectError("util.scand()");
  expectError("util.scand('12/20/2016')");
  expect("util.scand('mm/dd/yyyy', '12/20/2016').toUTCString()", tuesday);
  expect("util.scand('dd/mm/yyyy', '20/12/2016').toUTCString()", tuesday);
  expect("util.scand('yyyy/mm/dd', '2016/12/20').toUTCString()", tuesday);
  expect("util.scand('dd/mmm/yyyy', '20/Dec/2016').toUTCString()", tuesday);
  expect("util.scand('..dd:-:mmm/yyyy', '**20/*/Dec.2016').toUTCString()", tuesday);
  expect("util.scand('hh:MM:ss', '11:22:03').toUTCString()", friday);
  expect("util.scand('s:MM:hh', '3:22:11').toUTCString()", friday);
} catch (e) {
  app.alert("Truly unexpected error: " + e);
}
endstream
endobj
{{xref}}
{{trailer}}
{{startxref}}
%%EOF