projen 0.80.7 → 0.80.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +41 -41
- package/lib/awscdk/auto-discover.js +5 -5
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +1 -1
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose/docker-compose-service.js +1 -1
- package/lib/docker-compose/docker-compose.js +1 -1
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/actions-provider.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow-job.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflow-actions.js +1 -1
- package/lib/github/workflow-jobs.js +1 -1
- package/lib/github/workflow-steps.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +1 -1
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +4 -4
- package/lib/javascript/license-checker.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +2 -2
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/javascript/yarnrc.js +1 -1
- package/lib/json-patch.js +1 -1
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project-tree.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +2 -2
- package/lib/projenrc.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.d.ts +3 -7
- package/lib/python/poetry.js +21 -43
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/renovatebot.js +1 -1
- package/lib/sample-file.js +2 -2
- package/lib/semver.js +1 -1
- package/lib/source-code.js +1 -1
- package/lib/task-runtime.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +8 -10
- package/lib/typescript/projenrc-ts.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +6 -6
- package/lib/version.js +2 -2
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/@iarna/toml/LICENSE +14 -0
- package/node_modules/@iarna/toml/README.md +301 -0
- package/node_modules/@iarna/toml/index.d.ts +57 -0
- package/node_modules/@iarna/toml/lib/create-date.js +23 -0
- package/node_modules/@iarna/toml/lib/create-datetime-float.js +24 -0
- package/node_modules/@iarna/toml/lib/create-datetime.js +10 -0
- package/node_modules/@iarna/toml/lib/create-time.js +22 -0
- package/node_modules/@iarna/toml/lib/format-num.js +6 -0
- package/node_modules/@iarna/toml/lib/parser-debug.js +60 -0
- package/node_modules/@iarna/toml/lib/parser.js +127 -0
- package/node_modules/@iarna/toml/lib/toml-parser.js +1379 -0
- package/node_modules/@iarna/toml/package.json +82 -0
- package/node_modules/@iarna/toml/parse-async.js +30 -0
- package/node_modules/@iarna/toml/parse-pretty-error.js +33 -0
- package/node_modules/@iarna/toml/parse-stream.js +80 -0
- package/node_modules/@iarna/toml/parse-string.js +18 -0
- package/node_modules/@iarna/toml/parse.js +5 -0
- package/node_modules/@iarna/toml/stringify.js +296 -0
- package/node_modules/@iarna/toml/toml.js +3 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +4 -1
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +19 -10
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +5 -12
- package/node_modules/yaml/dist/parse/parser.js +4 -1
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +19 -10
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +5 -12
- package/node_modules/yaml/package.json +1 -1
- package/package.json +8 -8
- package/node_modules/json2toml/CHANGELOG.md +0 -128
- package/node_modules/json2toml/LICENSE.txt +0 -18
- package/node_modules/json2toml/README.md +0 -52
- package/node_modules/json2toml/index.d.ts +0 -13
- package/node_modules/json2toml/index.js +0 -160
- package/node_modules/json2toml/package.json +0 -62
- package/node_modules/lodash.isdate/LICENSE +0 -47
- package/node_modules/lodash.isdate/README.md +0 -18
- package/node_modules/lodash.isdate/index.js +0 -119
- package/node_modules/lodash.isdate/package.json +0 -17
- package/node_modules/lodash.isempty/LICENSE +0 -47
- package/node_modules/lodash.isempty/README.md +0 -18
- package/node_modules/lodash.isempty/index.js +0 -582
- package/node_modules/lodash.isempty/package.json +0 -17
- package/node_modules/lodash.isplainobject/LICENSE +0 -47
- package/node_modules/lodash.isplainobject/README.md +0 -18
- package/node_modules/lodash.isplainobject/index.js +0 -139
- package/node_modules/lodash.isplainobject/package.json +0 -17
- package/node_modules/strftime/Changelog.md +0 -286
- package/node_modules/strftime/Makefile +0 -15
- package/node_modules/strftime/Readme.md +0 -208
- package/node_modules/strftime/bower.json +0 -13
- package/node_modules/strftime/component.json +0 -16
- package/node_modules/strftime/package.json +0 -53
- package/node_modules/strftime/strftime-min.js +0 -21
- package/node_modules/strftime/strftime.js +0 -854
- package/node_modules/strftime/test.js +0 -271
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// Based on CoffeeScript by andrewschaaf on github
|
|
4
|
-
//
|
|
5
|
-
// TODO:
|
|
6
|
-
// - past and future dates, especially < 1900 and > 2100
|
|
7
|
-
// - look for edge cases
|
|
8
|
-
|
|
9
|
-
var assert = require('assert'),
|
|
10
|
-
libFilename = process.argv[2] || './strftime.js',
|
|
11
|
-
strftime = require(libFilename),
|
|
12
|
-
strftimeUTC = strftime.utc(),
|
|
13
|
-
Time = new Date(1307472705067); // Tue, 07 Jun 2011 18:51:45 GMT
|
|
14
|
-
|
|
15
|
-
assert.fn = function(value, msg) {
|
|
16
|
-
assert.equal(typeof value, 'function', msg);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function assertFormat(time, format, expected, name, strftime) {
|
|
20
|
-
var actual = strftime(format, time);
|
|
21
|
-
assert.equal(actual, expected, name + '("' + format + '", ' + time + ') is ' + JSON.stringify(actual) + ', expected ' + JSON.stringify(expected));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
assert.format = function(format, expected, expectedUTC, time) {
|
|
25
|
-
time = time || Time;
|
|
26
|
-
if (expected) { assertFormat(time, format, expected, 'strftime', strftime); }
|
|
27
|
-
assertFormat(time, format, expectedUTC || expected, 'strftime.utc()', strftimeUTC);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/// check exports
|
|
31
|
-
assert.fn(strftime.localize);
|
|
32
|
-
assert.fn(strftime.timezone);
|
|
33
|
-
assert.fn(strftime.utc);
|
|
34
|
-
ok('Exports');
|
|
35
|
-
|
|
36
|
-
/// time zones
|
|
37
|
-
if (process.env.TZ == 'America/Vancouver') {
|
|
38
|
-
testTimezone('America/Vancouver');
|
|
39
|
-
assert.format('%C', '01', '01', new Date(100, 0, 1));
|
|
40
|
-
assert.format('%X', '11:51:45 AM', '06:51:45 PM');
|
|
41
|
-
assert.format('%c', 'Tue 07 Jun 2011 11:51:45 AM Pacific Daylight Saving Time', 'Tue 07 Jun 2011 06:51:45 PM GMT');
|
|
42
|
-
assert.format('%j', '097', '098', new Date(1365390736236));
|
|
43
|
-
assert.format('%x', '06/07/11');
|
|
44
|
-
assert.format('%U', '12', null, new Date('2017-03-25 00:00:00 +0000'));
|
|
45
|
-
assert.format('%U', '12', '13', new Date('2017-03-26 00:00:00 +0000'));
|
|
46
|
-
assert.format('%U', '13', null, new Date('2017-03-27 00:00:00 +0000'));
|
|
47
|
-
assert.format('%U', '13', '14', new Date('2017-04-02 00:00:00 +0000'));
|
|
48
|
-
|
|
49
|
-
// Test dates crossing a DST boundary.
|
|
50
|
-
var dstStart = +new Date('2016-11-06 01:50:00');
|
|
51
|
-
assert.format('%T', '01:50:00', '08:50:00', new Date(dstStart))
|
|
52
|
-
assert.format('%T', '01:00:00', '09:00:00', new Date(dstStart + 10 * 60 * 1000))
|
|
53
|
-
|
|
54
|
-
ok('Time zones (' + process.env.TZ + ')');
|
|
55
|
-
}
|
|
56
|
-
else if (process.env.TZ == 'Europe/Amsterdam') {
|
|
57
|
-
testTimezone('Europe/Amsterdam');
|
|
58
|
-
assert.format('%C', '01', '00', new Date(100, 0, 1));
|
|
59
|
-
assert.format('%X', '08:51:45 PM', '06:51:45 PM');
|
|
60
|
-
assert.format('%c', 'Tue 07 Jun 2011 08:51:45 PM Central European Summer Time', 'Tue 07 Jun 2011 06:51:45 PM GMT');
|
|
61
|
-
assert.format('%j', '098', '098', new Date(1365390736236));
|
|
62
|
-
assert.format('%x', '06/07/11');
|
|
63
|
-
assert.format('%U', '12', null, new Date('2017-03-25 00:00:00 +0000'));
|
|
64
|
-
assert.format('%U', '13', null, new Date('2017-03-26 00:00:00 +0000'));
|
|
65
|
-
assert.format('%U', '13', null, new Date('2017-03-27 00:00:00 +0000'));
|
|
66
|
-
assert.format('%U', '14', null, new Date('2017-04-02 00:00:00 +0000'));
|
|
67
|
-
|
|
68
|
-
// Test dates crossing a DST boundary.
|
|
69
|
-
var dstStart = +new Date('2016-10-30 02:50:00');
|
|
70
|
-
assert.format('%T', '02:50:00', '00:50:00', new Date(dstStart))
|
|
71
|
-
assert.format('%T', '02:00:00', '01:00:00', new Date(dstStart + 10 * 60 * 1000))
|
|
72
|
-
|
|
73
|
-
ok('Time zones (' + process.env.TZ + ')');
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
assert(false, '(Current timezone has no tests: ' + (process.env.TZ || 'none') + ')');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/// check all formats in GMT, most coverage
|
|
80
|
-
assert.format('%A', 'Tuesday');
|
|
81
|
-
assert.format('%a', 'Tue');
|
|
82
|
-
assert.format('%B', 'June');
|
|
83
|
-
assert.format('%b', 'Jun');
|
|
84
|
-
assert.format('%C', '20');
|
|
85
|
-
assert.format('%D', '06/07/11');
|
|
86
|
-
assert.format('%d', '07');
|
|
87
|
-
assert.format('%-d', '7');
|
|
88
|
-
assert.format('%_d', ' 7');
|
|
89
|
-
assert.format('%0d', '07');
|
|
90
|
-
assert.format('%e', ' 7');
|
|
91
|
-
assert.format('%F', '2011-06-07');
|
|
92
|
-
assert.format('%H', null, '18');
|
|
93
|
-
assert.format('%h', 'Jun');
|
|
94
|
-
assert.format('%I', null, '06');
|
|
95
|
-
assert.format('%-I', null, '6');
|
|
96
|
-
assert.format('%_I', null, ' 6');
|
|
97
|
-
assert.format('%0I', null, '06');
|
|
98
|
-
assert.format('%j', null, '158');
|
|
99
|
-
assert.format('%k', null, '18');
|
|
100
|
-
assert.format('%L', '067');
|
|
101
|
-
assert.format('%l', null, ' 6');
|
|
102
|
-
assert.format('%-l', null, '6');
|
|
103
|
-
assert.format("%-y", "1", null, new Date('2001-02-03T04:05:06'))
|
|
104
|
-
assert.format("%-y", "23", null, new Date('2023-02-03T04:05:06'))
|
|
105
|
-
assert.format('%_l', null, ' 6');
|
|
106
|
-
assert.format('%0l', null, '06');
|
|
107
|
-
assert.format('%M', null, '51');
|
|
108
|
-
assert.format('%m', '06');
|
|
109
|
-
assert.format('%n', '\n');
|
|
110
|
-
assert.format('%o', '7th');
|
|
111
|
-
assert.format('%P', null, 'pm');
|
|
112
|
-
assert.format('%p', null, 'PM');
|
|
113
|
-
assert.format('%R', null, '18:51');
|
|
114
|
-
assert.format('%r', null, '06:51:45 PM');
|
|
115
|
-
assert.format('%S', '45');
|
|
116
|
-
assert.format('%s', '1307472705');
|
|
117
|
-
assert.format('%T', null, '18:51:45');
|
|
118
|
-
assert.format('%t', '\t');
|
|
119
|
-
assert.format('%U', '23');
|
|
120
|
-
assert.format('%U', '24', null, new Date(+Time + 5 * 86400000));
|
|
121
|
-
assert.format('%u', '2');
|
|
122
|
-
assert.format('%v', ' 7-Jun-2011');
|
|
123
|
-
assert.format('%W', '23');
|
|
124
|
-
assert.format('%W', '23', null, new Date(+Time + 5 * 86400000));
|
|
125
|
-
assert.format('%w', '2');
|
|
126
|
-
assert.format('%Y', '2011');
|
|
127
|
-
assert.format('%y', '11');
|
|
128
|
-
assert.format('%Z', null, 'GMT');
|
|
129
|
-
assert.format('%z', null, '+0000');
|
|
130
|
-
assert.format('%:z', null, '+00:00');
|
|
131
|
-
assert.format('%%', '%'); // literal percent sign
|
|
132
|
-
assert.format('%g', '%g'); // unrecognized directive
|
|
133
|
-
assert.format('%F %T', null, '1970-01-01 00:00:00', new Date(0));
|
|
134
|
-
assert.format('%U', null, '12', new Date('2017-03-25 00:00:00 +0000'));
|
|
135
|
-
assert.format('%U', null, '13', new Date('2017-03-26 00:00:00 +0000'));
|
|
136
|
-
assert.format('%U', null, '13', new Date('2017-03-27 00:00:00 +0000'));
|
|
137
|
-
assert.format('%U', null, '14', new Date('2017-04-02 00:00:00 +0000'));
|
|
138
|
-
ok('GMT');
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
/// locales
|
|
142
|
-
|
|
143
|
-
var it_IT = {
|
|
144
|
-
days: words('domenica lunedi martedi mercoledi giovedi venerdi sabato'),
|
|
145
|
-
shortDays: words('dom lun mar mer gio ven sab'),
|
|
146
|
-
months: words('gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre'),
|
|
147
|
-
shortMonths: words('gen feb mar apr mag giu lug ago set ott nov dic'),
|
|
148
|
-
AM: 'it$AM',
|
|
149
|
-
PM: 'it$PM',
|
|
150
|
-
am: 'it$am',
|
|
151
|
-
pm: 'it$pm',
|
|
152
|
-
formats: {
|
|
153
|
-
D: 'it$%m/%d/%y',
|
|
154
|
-
F: 'it$%Y-%m-%d',
|
|
155
|
-
R: 'it$%H:%M',
|
|
156
|
-
T: 'it$%H:%M:%S',
|
|
157
|
-
X: '%T',
|
|
158
|
-
c: '%a %b %d %X %Y',
|
|
159
|
-
r: 'it$%I:%M:%S %p',
|
|
160
|
-
v: 'it$%e-%b-%Y',
|
|
161
|
-
x: '%D'
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
var strftimeIT = strftime.localize(it_IT),
|
|
166
|
-
strftimeITUTC = strftimeIT.utc();
|
|
167
|
-
assert.format_it = function(format, expected, expectedUTC) {
|
|
168
|
-
if (expected) { assertFormat(Time, format, expected, 'strftime.localize(it_IT)', strftimeIT); }
|
|
169
|
-
assertFormat(Time, format, expectedUTC || expected, 'strftime.localize(it_IT).utc()', strftimeITUTC);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
assert.format_it('%A', 'martedi');
|
|
173
|
-
assert.format_it('%a', 'mar');
|
|
174
|
-
assert.format_it('%B', 'giugno');
|
|
175
|
-
assert.format_it('%b', 'giu');
|
|
176
|
-
assert.format_it('%c', null, 'mar giu 07 it$18:51:45 2011');
|
|
177
|
-
assert.format_it('%D', 'it$06/07/11');
|
|
178
|
-
assert.format_it('%F', 'it$2011-06-07');
|
|
179
|
-
assert.format_it('%p', null, 'it$PM');
|
|
180
|
-
assert.format_it('%P', null, 'it$pm');
|
|
181
|
-
assert.format_it('%R', null, 'it$18:51');
|
|
182
|
-
assert.format_it('%r', null, 'it$06:51:45 it$PM');
|
|
183
|
-
assert.format_it('%T', null, 'it$18:51:45');
|
|
184
|
-
assert.format_it('%v', 'it$ 7-giu-2011');
|
|
185
|
-
assert.format_it('%x', null, 'it$06/07/11');
|
|
186
|
-
assert.format_it('%X', null, 'it$18:51:45');
|
|
187
|
-
ok('Localization');
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
/// timezones
|
|
191
|
-
|
|
192
|
-
assert.formatTZ = function(format, expected, tz, time) {
|
|
193
|
-
assertFormat(time || Time, format, expected, 'strftime.timezone(' + tz + ')', strftime.timezone(tz));
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
assert.formatTZ('%F %r %z', '2011-06-07 06:51:45 PM +0000', 0);
|
|
197
|
-
assert.formatTZ('%F %r %z', '2011-06-07 06:51:45 PM +0000', '+0000');
|
|
198
|
-
assert.formatTZ('%F %r %z', '2011-06-07 08:51:45 PM +0200', 120);
|
|
199
|
-
assert.formatTZ('%F %r %z', '2011-06-07 08:51:45 PM +0200', '+0200');
|
|
200
|
-
assert.formatTZ('%F %r %z', '2011-06-07 11:51:45 AM -0700', -420);
|
|
201
|
-
assert.formatTZ('%F %r %z', '2011-06-07 11:51:45 AM -0700', '-0700');
|
|
202
|
-
assert.formatTZ('%F %r %z', '2011-06-07 11:21:45 AM -0730', '-0730');
|
|
203
|
-
assert.formatTZ('%F %r %:z', '2011-06-07 11:21:45 AM -07:30', '-0730');
|
|
204
|
-
ok('Time zone offset');
|
|
205
|
-
|
|
206
|
-
/// caching
|
|
207
|
-
(function() {
|
|
208
|
-
// this test fails when the 2 calls cross a millisecond boundary, so try a number of times
|
|
209
|
-
var CacheAttempts = 10;
|
|
210
|
-
var MaxFailures = 1;
|
|
211
|
-
var failures = 0;
|
|
212
|
-
for (var i = 0; i < CacheAttempts; ++i) {
|
|
213
|
-
var expectedMillis = strftime('%L');
|
|
214
|
-
var millis = strftime('%L');
|
|
215
|
-
if (expectedMillis != millis) {
|
|
216
|
-
++failures;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
if (failures > MaxFailures) {
|
|
220
|
-
assert.fail('timestamp caching appears to be broken (' + failures + ' failed attempts out of ' + CacheAttempts + ')');
|
|
221
|
-
}
|
|
222
|
-
}());
|
|
223
|
-
ok('Cached timestamps');
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
/// helpers
|
|
227
|
-
|
|
228
|
-
function words(s) { return (s || '').split(' '); }
|
|
229
|
-
|
|
230
|
-
function ok(s) { console.log('[ \033[32mOK\033[0m ] ' + s); }
|
|
231
|
-
|
|
232
|
-
// Pass a regex or string that matches the timezone abbrev, e.g. %Z above.
|
|
233
|
-
// Don't pass GMT! Every date includes it and it will fail.
|
|
234
|
-
// Be careful if you pass a regex, it has to quack like the default one.
|
|
235
|
-
function testTimezone(regex) {
|
|
236
|
-
regex = typeof regex === 'string' ? RegExp('\\((' + regex + ')\\)$') : regex;
|
|
237
|
-
var match = Time.toString().match(regex);
|
|
238
|
-
if (match) {
|
|
239
|
-
var off = Time.getTimezoneOffset(),
|
|
240
|
-
hourOff = off / 60,
|
|
241
|
-
hourDiff = Math.floor(hourOff),
|
|
242
|
-
hours = 18 - hourDiff,
|
|
243
|
-
padSpace24 = hours < 10 ? ' ' : '',
|
|
244
|
-
padZero24 = hours < 10 ? '0' : '',
|
|
245
|
-
hour24 = String(hours),
|
|
246
|
-
padSpace12 = (hours % 12) < 10 ? ' ' : '',
|
|
247
|
-
padZero12 = (hours % 12) < 10 ? '0' : '',
|
|
248
|
-
hour12 = String(hours % 12),
|
|
249
|
-
sign = hourDiff < 0 ? '+' : '-',
|
|
250
|
-
minDiff = Time.getTimezoneOffset() - (hourDiff * 60),
|
|
251
|
-
mins = String(51 - minDiff),
|
|
252
|
-
tz = match[1],
|
|
253
|
-
ampm = hour12 == hour24 ? 'AM' : 'PM',
|
|
254
|
-
R = hour24 + ':' + mins,
|
|
255
|
-
r = padZero12 + hour12 + ':' + mins + ':45 ' + ampm,
|
|
256
|
-
T = R + ':45';
|
|
257
|
-
assert.format('%H', padZero24 + hour24, '18');
|
|
258
|
-
assert.format('%I', padZero12 + hour12, '06');
|
|
259
|
-
assert.format('%k', padSpace24 + hour24, '18');
|
|
260
|
-
assert.format('%l', padSpace12 + hour12, ' 6');
|
|
261
|
-
assert.format('%M', mins);
|
|
262
|
-
assert.format('%P', ampm.toLowerCase(), 'pm');
|
|
263
|
-
assert.format('%p', ampm, 'PM');
|
|
264
|
-
assert.format('%R', R, '18:51');
|
|
265
|
-
assert.format('%r', r, '06:51:45 PM');
|
|
266
|
-
assert.format('%T', T, '18:51:45');
|
|
267
|
-
assert.format('%Z', tz, 'GMT');
|
|
268
|
-
assert.format('%z', sign + '0' + Math.abs(hourDiff) + '00', '+0000');
|
|
269
|
-
assert.format('%:z', sign + '0' + Math.abs(hourDiff) + ':00', '+00:00');
|
|
270
|
-
}
|
|
271
|
-
}
|