aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-30 17:27:52 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-30 17:27:52 -0400
commit8cba6c3c24c2122c843aa0feaa26fd6e5c2412e2 (patch)
treeae0583da790de2416f03a27e9f94953be7d4a803 /test
parentd853d7b8dc1586f6b2fad3bf05998bfbe935b8f3 (diff)
Deprecate built-in Moment datatype in favor of a `time` module
Diffstat (limited to 'test')
-rw-r--r--test/moments.tm49
-rw-r--r--test/serialization.tm6
2 files changed, 0 insertions, 55 deletions
diff --git a/test/moments.tm b/test/moments.tm
deleted file mode 100644
index 657c1522..00000000
--- a/test/moments.tm
+++ /dev/null
@@ -1,49 +0,0 @@
-
-func main():
- >> 2024-1-1 12:00[America/New_York] == 2024-1-1T09:00[America/Los_Angeles]
- = yes
- >> 2024-1-1 12:00[America/New_York] == Moment(2024, 1, 1, hour=9, timezone="America/Los_Angeles")
- = yes
-
- >> t := 2024-1-2 13:45[America/New_York]
- >> t:after(days=40) == 2024-2-11T13:45:00[America/New_York]
- = yes
- >> t:date(timezone="America/New_York")
- = "2024-01-02"
-
- >> t:time(timezone="America/New_York")
- = "1:45pm"
-
- >> t:time(am_pm=no, timezone="America/New_York")
- = "13:45"
-
- >> t:relative(relative_to=t:after(minutes=65))
- = "1 hour ago"
-
- >> t:seconds_till(t:after(minutes=2))
- = 120.
-
- >> t:minutes_till(t:after(minutes=2))
- = 2.
-
- >> t:hours_till(t:after(minutes=60))
- = 1.
-
- >> t:day_of_week() # 1 = Sun, 2 = Mon, 3 = Tue
- = 3
-
- >> t:format("%A")
- = "Tuesday"
-
- >> t:unix_timestamp()
- = Int64(1704221100)
- >> t == Moment.from_unix_timestamp(1704221100)
- = yes
-
- >> t < t:after(minutes=1)
- = yes
-
- >> t < t:after(seconds=0.1)
- = yes
-
- >> now()
diff --git a/test/serialization.tm b/test/serialization.tm
index 9afb4bcf..6d08552f 100644
--- a/test/serialization.tm
+++ b/test/serialization.tm
@@ -5,12 +5,6 @@ enum MyEnum(Zero, One(x:Int), Two(x:Num, y:Text))
func main():
do:
- >> obj := now()
- >> bytes := obj:serialized()
- >> deserialize(bytes -> Moment) == obj
- = yes
-
- do:
>> obj := Int64(123)
>> bytes := obj:serialized()
>> deserialize(bytes -> Int64) == obj