-
Notifications
You must be signed in to change notification settings - Fork 12
/
run
executable file
·64 lines (51 loc) · 1.43 KB
/
run
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
58
59
60
61
62
63
64
#!/usr/bin/env bash
TESTS_INIT=tests/minimal_init.lua
TESTS_DIR=tests
function _test_tz {
# DST always in effect
echo "Checking with $1 time zone (DST always enable)"
TZ=$1
export TZ
nvim \
--headless \
--noplugin \
-u ${TESTS_INIT} \
-c "PlenaryBustedDirectory ${TESTS_DIR}/dial/augend/date_spec.lua \
{ minimal_init = '${TESTS_INIT}' }"
}
function test {
# Force TimeZone to ensure consistent behavior of os.date regarding Daylight
# Saving Time
# Standard case (No DST)
# Full test case
TZ='GMT+0'
export TZ
nvim \
--headless \
--noplugin \
-u ${TESTS_INIT} \
-c "PlenaryBustedDirectory ${TESTS_DIR} \
{ minimal_init = '${TESTS_INIT}' }" ||
return 1
# permanent DST: os.date always returns `isdst == false`
_test_tz "Asia/Tokyo" || return 1
# Check standard DST. Since the date is not controlled, we might have
# periods of time without any timezone with `isdst == true`.
# Therefore, select timezones that overlap so that DST is actually
# tested.
# DST in Northern hemisphere
# Start: Second Sunday in March at 2:00
# End: First Sunday in November at 2:00
_test_tz "America/New_York" || return 1
# DST in Southern hemisphere
# Start: First Sunday in October at 2:00
# End: First Sunday in April at 3:00
_test_tz "Australia/Sidney" || return 1
}
function help {
echo "$0 <task> <args>"
echo "Tasks:"
compgen -A function | cat -n
}
TIMEFORMAT="Task completed in %3lR"
time ${@:-default}