aboutsummaryrefslogtreecommitdiff
path: root/iterator_test.go
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2026-11-10 18:03:37 +0100
committerSandro Jäckel <sandro.jaeckel@gmail.com>2026-11-10 18:03:51 +0100
commit0738cfbbdbbf898d9e864970924e59d0a2af45e3 (patch)
treefaf2d31bf4438fcf25c9f50f5b87b0d14e65902a /iterator_test.go
parent537dbec6f63eff137a582dc4e8e7a06d20083237 (diff)
downloadgo-schwift-0738cfbbdbbf898d9e864970924e59d0a2af45e3.tar.gz
Fix that Ceph Swift API emulation contains timezone
Diffstat (limited to 'iterator_test.go')
-rw-r--r--iterator_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/iterator_test.go b/iterator_test.go
new file mode 100644
index 0000000..6ea8599
--- /dev/null
+++ b/iterator_test.go
@@ -0,0 +1,28 @@
+// SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net>
+// SPDX-License-Identifier: Apache-2.0
+
+package schwift
+
+import (
+ "testing"
+ "time"
+)
+
+func TestParseSwiftLastModified(t *testing.T) {
+ want := time.Date(2026, time.November, 10, 15, 37, 37, 707_000_000, time.UTC)
+ for _, input := range []string{
+ "2026-11-10T15:37:37.707", // Swift's timezone-less format
+ "2026-11-10T15:37:37.707Z", // UTC timezone
+ "2026-11-10T16:37:37.707+01:00", // Explicit offset
+ } {
+ t.Run(input, func(t *testing.T) {
+ got, err := parseSwiftLastModified(input)
+ if err != nil {
+ t.Fatalf("parseSwiftLastModified(%q) returned an error: %v", input, err)
+ }
+ if !got.Equal(want) {
+ t.Errorf("parseSwiftLastModified(%q) = %s, want %s", input, got, want)
+ }
+ })
+ }
+}