mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
refactor(tests): replace ptr with new for int64 values in lyric tests
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
cb18e49eed
commit
c8c86b5bfe
@ -1,5 +0,0 @@
|
||||
package lyrics_test
|
||||
|
||||
func ptr[T any](v T) *T {
|
||||
return &v
|
||||
}
|
||||
@ -52,20 +52,20 @@ var _ = Describe("sources", func() {
|
||||
Lang: "eng",
|
||||
Line: []model.Line{
|
||||
{
|
||||
Start: ptr(int64(1000)),
|
||||
End: ptr(int64(3000)),
|
||||
Start: new(int64(1000)),
|
||||
End: new(int64(3000)),
|
||||
Value: "Lead words",
|
||||
Cue: []model.Cue{
|
||||
{
|
||||
Start: ptr(int64(1000)),
|
||||
End: ptr(int64(1500)),
|
||||
Start: new(int64(1000)),
|
||||
End: new(int64(1500)),
|
||||
Value: "Lead ",
|
||||
ByteStart: 0,
|
||||
ByteEnd: 4,
|
||||
},
|
||||
{
|
||||
Start: ptr(int64(1500)),
|
||||
End: ptr(int64(3000)),
|
||||
Start: new(int64(1500)),
|
||||
End: new(int64(3000)),
|
||||
Value: "words",
|
||||
ByteStart: 5,
|
||||
ByteEnd: 9,
|
||||
@ -73,7 +73,7 @@ var _ = Describe("sources", func() {
|
||||
},
|
||||
},
|
||||
{
|
||||
Start: ptr(int64(3000)),
|
||||
Start: new(int64(3000)),
|
||||
Value: "Fallback line",
|
||||
},
|
||||
},
|
||||
@ -87,11 +87,11 @@ var _ = Describe("sources", func() {
|
||||
Lang: "eng",
|
||||
Line: []model.Line{
|
||||
{
|
||||
Start: ptr(int64(18800)),
|
||||
Start: new(int64(18800)),
|
||||
Value: "We're no strangers to love",
|
||||
},
|
||||
{
|
||||
Start: ptr(int64(22800)),
|
||||
Start: new(int64(22800)),
|
||||
Value: "You know the rules and so do I",
|
||||
},
|
||||
},
|
||||
@ -102,7 +102,7 @@ var _ = Describe("sources", func() {
|
||||
Lang: "por",
|
||||
Line: []model.Line{
|
||||
{
|
||||
Start: ptr(int64(18800)),
|
||||
Start: new(int64(18800)),
|
||||
Value: "Nao somos estranhos ao amor",
|
||||
},
|
||||
},
|
||||
@ -130,13 +130,13 @@ var _ = Describe("sources", func() {
|
||||
Lang: "xxx",
|
||||
Line: []model.Line{
|
||||
{
|
||||
Start: ptr(int64(18800)),
|
||||
End: ptr(int64(22800)),
|
||||
Start: new(int64(18800)),
|
||||
End: new(int64(22800)),
|
||||
Value: "We're from subtitles",
|
||||
},
|
||||
{
|
||||
Start: ptr(int64(22801)),
|
||||
End: ptr(int64(26000)),
|
||||
Start: new(int64(22801)),
|
||||
End: new(int64(26000)),
|
||||
Value: "Another subtitle line",
|
||||
},
|
||||
},
|
||||
@ -218,7 +218,7 @@ var _ = Describe("sources", func() {
|
||||
Expect(err).To(BeNil())
|
||||
Expect(list).To(HaveLen(1))
|
||||
Expect(list[0].Line).To(Equal([]model.Line{
|
||||
{Start: ptr(int64(1000)), Value: "Upper suffix"},
|
||||
{Start: new(int64(1000)), Value: "Upper suffix"},
|
||||
}))
|
||||
})
|
||||
|
||||
@ -242,7 +242,7 @@ var _ = Describe("sources", func() {
|
||||
Expect(err).To(BeNil())
|
||||
Expect(list).To(HaveLen(1))
|
||||
Expect(list[0].Line).To(Equal([]model.Line{
|
||||
{Start: ptr(int64(1000)), Value: "Fallback line"},
|
||||
{Start: new(int64(1000)), Value: "Fallback line"},
|
||||
}))
|
||||
})
|
||||
|
||||
|
||||
@ -100,40 +100,40 @@ var _ = Describe("sources", func() {
|
||||
Expect(lyrics[0].Line).To(HaveLen(3))
|
||||
|
||||
// Line 1: has inline markers → Cue array populated
|
||||
Expect(lyrics[0].Line[0].Start).To(Equal(ptr(int64(1000))))
|
||||
Expect(lyrics[0].Line[0].End).To(Equal(ptr(int64(3000))))
|
||||
Expect(lyrics[0].Line[0].Start).To(Equal(new(int64(1000))))
|
||||
Expect(lyrics[0].Line[0].End).To(Equal(new(int64(3000))))
|
||||
Expect(lyrics[0].Line[0].Value).To(Equal("Some lyrics here"))
|
||||
Expect(lyrics[0].Line[0].Cue).To(HaveLen(3))
|
||||
Expect(*lyrics[0].Line[0].Cue[0].Start).To(Equal(int64(1000)))
|
||||
Expect(lyrics[0].Line[0].Cue[0].Value).To(Equal("Some "))
|
||||
Expect(lyrics[0].Line[0].Cue[0].End).To(Equal(ptr(int64(1500))))
|
||||
Expect(lyrics[0].Line[0].Cue[0].End).To(Equal(new(int64(1500))))
|
||||
Expect(lyrics[0].Line[0].Cue[0].ByteStart).To(Equal(0))
|
||||
Expect(lyrics[0].Line[0].Cue[0].ByteEnd).To(Equal(4))
|
||||
Expect(*lyrics[0].Line[0].Cue[1].Start).To(Equal(int64(1500)))
|
||||
Expect(lyrics[0].Line[0].Cue[1].Value).To(Equal("lyrics "))
|
||||
Expect(lyrics[0].Line[0].Cue[1].End).To(Equal(ptr(int64(2000))))
|
||||
Expect(lyrics[0].Line[0].Cue[1].End).To(Equal(new(int64(2000))))
|
||||
Expect(lyrics[0].Line[0].Cue[1].ByteStart).To(Equal(5))
|
||||
Expect(lyrics[0].Line[0].Cue[1].ByteEnd).To(Equal(11))
|
||||
Expect(*lyrics[0].Line[0].Cue[2].Start).To(Equal(int64(2000)))
|
||||
Expect(lyrics[0].Line[0].Cue[2].Value).To(Equal("here"))
|
||||
Expect(lyrics[0].Line[0].Cue[2].End).To(Equal(ptr(int64(3000))))
|
||||
Expect(lyrics[0].Line[0].Cue[2].End).To(Equal(new(int64(3000))))
|
||||
Expect(lyrics[0].Line[0].Cue[2].ByteStart).To(Equal(12))
|
||||
Expect(lyrics[0].Line[0].Cue[2].ByteEnd).To(Equal(15))
|
||||
|
||||
// Line 2: has inline markers
|
||||
Expect(lyrics[0].Line[1].Start).To(Equal(ptr(int64(3000))))
|
||||
Expect(lyrics[0].Line[1].End).To(Equal(ptr(int64(5000))))
|
||||
Expect(lyrics[0].Line[1].Start).To(Equal(new(int64(3000))))
|
||||
Expect(lyrics[0].Line[1].End).To(Equal(new(int64(5000))))
|
||||
Expect(lyrics[0].Line[1].Value).To(Equal("More words"))
|
||||
Expect(lyrics[0].Line[1].Cue).To(HaveLen(2))
|
||||
Expect(lyrics[0].Line[1].Cue[0].End).To(Equal(ptr(int64(3500))))
|
||||
Expect(lyrics[0].Line[1].Cue[1].End).To(Equal(ptr(int64(5000))))
|
||||
Expect(lyrics[0].Line[1].Cue[0].End).To(Equal(new(int64(3500))))
|
||||
Expect(lyrics[0].Line[1].Cue[1].End).To(Equal(new(int64(5000))))
|
||||
Expect(lyrics[0].Line[1].Cue[0].ByteStart).To(Equal(0))
|
||||
Expect(lyrics[0].Line[1].Cue[0].ByteEnd).To(Equal(4))
|
||||
Expect(lyrics[0].Line[1].Cue[1].ByteStart).To(Equal(5))
|
||||
Expect(lyrics[0].Line[1].Cue[1].ByteEnd).To(Equal(9))
|
||||
|
||||
// Line 3: plain line, no cues
|
||||
Expect(lyrics[0].Line[2].Start).To(Equal(ptr(int64(5000))))
|
||||
Expect(lyrics[0].Line[2].Start).To(Equal(new(int64(5000))))
|
||||
Expect(lyrics[0].Line[2].Value).To(Equal("Plain line without inline markers"))
|
||||
Expect(lyrics[0].Line[2].Cue).To(BeNil())
|
||||
})
|
||||
@ -150,22 +150,22 @@ var _ = Describe("sources", func() {
|
||||
Expect(lyrics[0].Synced).To(BeTrue())
|
||||
Expect(lyrics[0].Line).To(HaveLen(2))
|
||||
|
||||
Expect(lyrics[0].Line[0].Start).To(Equal(ptr(int64(1000))))
|
||||
Expect(lyrics[0].Line[0].End).To(Equal(ptr(int64(3000))))
|
||||
Expect(lyrics[0].Line[0].Start).To(Equal(new(int64(1000))))
|
||||
Expect(lyrics[0].Line[0].End).To(Equal(new(int64(3000))))
|
||||
Expect(lyrics[0].Line[0].Value).To(Equal("Lead words"))
|
||||
Expect(lyrics[0].Line[0].Cue).To(HaveLen(2))
|
||||
Expect(*lyrics[0].Line[0].Cue[0].Start).To(Equal(int64(1000)))
|
||||
Expect(lyrics[0].Line[0].Cue[0].Value).To(Equal("Lead "))
|
||||
Expect(lyrics[0].Line[0].Cue[0].End).To(Equal(ptr(int64(1500))))
|
||||
Expect(lyrics[0].Line[0].Cue[0].End).To(Equal(new(int64(1500))))
|
||||
Expect(lyrics[0].Line[0].Cue[0].ByteStart).To(Equal(0))
|
||||
Expect(lyrics[0].Line[0].Cue[0].ByteEnd).To(Equal(4))
|
||||
Expect(*lyrics[0].Line[0].Cue[1].Start).To(Equal(int64(1500)))
|
||||
Expect(lyrics[0].Line[0].Cue[1].Value).To(Equal("words"))
|
||||
Expect(lyrics[0].Line[0].Cue[1].End).To(Equal(ptr(int64(3000))))
|
||||
Expect(lyrics[0].Line[0].Cue[1].End).To(Equal(new(int64(3000))))
|
||||
Expect(lyrics[0].Line[0].Cue[1].ByteStart).To(Equal(5))
|
||||
Expect(lyrics[0].Line[0].Cue[1].ByteEnd).To(Equal(9))
|
||||
|
||||
Expect(lyrics[0].Line[1].Start).To(Equal(ptr(int64(3000))))
|
||||
Expect(lyrics[0].Line[1].Start).To(Equal(new(int64(3000))))
|
||||
Expect(lyrics[0].Line[1].Value).To(Equal("Fallback line"))
|
||||
Expect(lyrics[0].Line[1].Cue).To(BeNil())
|
||||
})
|
||||
@ -201,13 +201,13 @@ var _ = Describe("sources", func() {
|
||||
Lang: "xxx",
|
||||
Line: []model.Line{
|
||||
{
|
||||
Start: ptr(int64(18800)),
|
||||
End: ptr(int64(22800)),
|
||||
Start: new(int64(18800)),
|
||||
End: new(int64(22800)),
|
||||
Value: "We're from subtitles",
|
||||
},
|
||||
{
|
||||
Start: ptr(int64(22801)),
|
||||
End: ptr(int64(26000)),
|
||||
Start: new(int64(22801)),
|
||||
End: new(int64(26000)),
|
||||
Value: "Another subtitle line",
|
||||
},
|
||||
},
|
||||
@ -227,11 +227,11 @@ var _ = Describe("sources", func() {
|
||||
Lang: "eng",
|
||||
Line: []model.Line{
|
||||
{
|
||||
Start: ptr(int64(18800)),
|
||||
Start: new(int64(18800)),
|
||||
Value: "We're no strangers to love",
|
||||
},
|
||||
{
|
||||
Start: ptr(int64(22800)),
|
||||
Start: new(int64(22800)),
|
||||
Value: "You know the rules and so do I",
|
||||
},
|
||||
},
|
||||
@ -242,7 +242,7 @@ var _ = Describe("sources", func() {
|
||||
Lang: "por",
|
||||
Line: []model.Line{
|
||||
{
|
||||
Start: ptr(int64(18800)),
|
||||
Start: new(int64(18800)),
|
||||
Value: "Nao somos estranhos ao amor",
|
||||
},
|
||||
},
|
||||
@ -294,7 +294,7 @@ var _ = Describe("sources", func() {
|
||||
Expect(lyrics[0].Kind).To(Equal("main"))
|
||||
Expect(lyrics[0].Synced).To(BeTrue())
|
||||
Expect(lyrics[0].Line).To(HaveLen(1))
|
||||
Expect(lyrics[0].Line[0].Start).To(Equal(ptr(int64(0))))
|
||||
Expect(lyrics[0].Line[0].Start).To(Equal(new(int64(0))))
|
||||
Expect(lyrics[0].Line[0].Value).To(Equal("BOM test line"))
|
||||
})
|
||||
|
||||
@ -307,9 +307,9 @@ var _ = Describe("sources", func() {
|
||||
Expect(lyrics[0].Kind).To(Equal("main"))
|
||||
Expect(lyrics[0].Synced).To(BeTrue())
|
||||
Expect(lyrics[0].Line).To(HaveLen(2))
|
||||
Expect(lyrics[0].Line[0].Start).To(Equal(ptr(int64(18800))))
|
||||
Expect(lyrics[0].Line[0].Start).To(Equal(new(int64(18800))))
|
||||
Expect(lyrics[0].Line[0].Value).To(Equal("UTF16 line one"))
|
||||
Expect(lyrics[0].Line[1].Start).To(Equal(ptr(int64(22801))))
|
||||
Expect(lyrics[0].Line[1].Start).To(Equal(new(int64(22801))))
|
||||
Expect(lyrics[0].Line[1].Value).To(Equal("UTF16 line two"))
|
||||
})
|
||||
|
||||
@ -325,10 +325,10 @@ var _ = Describe("sources", func() {
|
||||
Kind: "main",
|
||||
Lang: "eng",
|
||||
Line: []model.Line{
|
||||
{Start: ptr(int64(18800)), End: ptr(int64(22801)), Value: "We're no strangers to love"},
|
||||
{Start: ptr(int64(22801)), Value: "You know the rules and so do I"},
|
||||
{Start: new(int64(18800)), End: new(int64(22801)), Value: "We're no strangers to love"},
|
||||
{Start: new(int64(22801)), Value: "You know the rules and so do I"},
|
||||
},
|
||||
Offset: ptr(int64(-100)),
|
||||
Offset: new(int64(-100)),
|
||||
Synced: true,
|
||||
},
|
||||
}))
|
||||
@ -349,20 +349,20 @@ var _ = Describe("sources", func() {
|
||||
Expect(lyrics[0].Line).To(HaveLen(1))
|
||||
|
||||
line := lyrics[0].Line[0]
|
||||
Expect(line.Start).To(Equal(ptr(int64(1000))))
|
||||
Expect(line.End).To(Equal(ptr(int64(3000))))
|
||||
Expect(line.Start).To(Equal(new(int64(1000))))
|
||||
Expect(line.End).To(Equal(new(int64(3000))))
|
||||
Expect(line.Value).To(Equal("Hello world"))
|
||||
Expect(line.Cue).To(HaveLen(2))
|
||||
|
||||
Expect(line.Cue[0].Start).To(Equal(ptr(int64(1000))))
|
||||
Expect(line.Cue[0].End).To(Equal(ptr(int64(1500))))
|
||||
Expect(line.Cue[0].Start).To(Equal(new(int64(1000))))
|
||||
Expect(line.Cue[0].End).To(Equal(new(int64(1500))))
|
||||
Expect(line.Cue[0].Value).To(Equal("Hello "))
|
||||
Expect(line.Cue[0].ByteStart).To(Equal(0))
|
||||
Expect(line.Cue[0].ByteEnd).To(Equal(5))
|
||||
Expect(line.Cue[0].AgentID).To(Equal(""))
|
||||
|
||||
Expect(line.Cue[1].Start).To(Equal(ptr(int64(1500))))
|
||||
Expect(line.Cue[1].End).To(Equal(ptr(int64(3000))))
|
||||
Expect(line.Cue[1].Start).To(Equal(new(int64(1500))))
|
||||
Expect(line.Cue[1].End).To(Equal(new(int64(3000))))
|
||||
Expect(line.Cue[1].Value).To(Equal("world"))
|
||||
Expect(line.Cue[1].ByteStart).To(Equal(6))
|
||||
Expect(line.Cue[1].ByteEnd).To(Equal(10))
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
package lyrics
|
||||
|
||||
func ptr[T any](v T) *T {
|
||||
return &v
|
||||
}
|
||||
@ -35,8 +35,8 @@ var _ = Describe("ParseEmbedded", func() {
|
||||
Expect(list[0].Synced).To(BeTrue())
|
||||
Expect(list[0].Agents).To(Equal([]Agent{{ID: "lead", Role: "main", Name: "Lead Vocal"}}))
|
||||
Expect(list[0].Line).To(HaveLen(1))
|
||||
Expect(list[0].Line[0].Start).To(Equal(ptr(int64(1000))))
|
||||
Expect(list[0].Line[0].End).To(Equal(ptr(int64(3000))))
|
||||
Expect(list[0].Line[0].Start).To(Equal(new(int64(1000))))
|
||||
Expect(list[0].Line[0].End).To(Equal(new(int64(3000))))
|
||||
Expect(list[0].Line[0].Value).To(Equal("Hello world"))
|
||||
Expect(list[0].Line[0].Cue).To(HaveLen(2))
|
||||
Expect(list[0].Line[0].Cue[0].AgentID).To(Equal("lead"))
|
||||
@ -104,13 +104,13 @@ Another subtitle line`
|
||||
Lang: "por",
|
||||
Line: []Line{
|
||||
{
|
||||
Start: ptr(int64(18800)),
|
||||
End: ptr(int64(22800)),
|
||||
Start: new(int64(18800)),
|
||||
End: new(int64(22800)),
|
||||
Value: "We're from subtitles",
|
||||
},
|
||||
{
|
||||
Start: ptr(int64(22801)),
|
||||
End: ptr(int64(26000)),
|
||||
Start: new(int64(22801)),
|
||||
End: new(int64(26000)),
|
||||
Value: "Another subtitle line",
|
||||
},
|
||||
},
|
||||
@ -127,8 +127,8 @@ Another subtitle line`
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(list).To(HaveLen(1))
|
||||
Expect(list[0].Line).To(Equal([]Line{
|
||||
{Start: ptr(int64(1000)), End: ptr(int64(2000)), Value: "First subtitle"},
|
||||
{Start: ptr(int64(3000)), End: ptr(int64(4000)), Value: "Second subtitle"},
|
||||
{Start: new(int64(1000)), End: new(int64(2000)), Value: "First subtitle"},
|
||||
{Start: new(int64(3000)), End: new(int64(4000)), Value: "Second subtitle"},
|
||||
}))
|
||||
})
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
package model
|
||||
|
||||
func ptr[T any](v T) *T {
|
||||
return &v
|
||||
}
|
||||
@ -29,15 +29,15 @@ var _ = Describe("ParseTTML", func() {
|
||||
eng := list[0]
|
||||
Expect(eng.Lang).To(Equal("eng"))
|
||||
Expect(eng.Synced).To(BeTrue())
|
||||
Expect(eng.Line[0].Start).To(Equal(ptr(int64(3000))))
|
||||
Expect(eng.Line[0].Start).To(Equal(new(int64(3000))))
|
||||
Expect(eng.Line[0].Value).To(Equal("Line one"))
|
||||
Expect(eng.Line[1].Start).To(Equal(ptr(int64(4517))))
|
||||
Expect(eng.Line[1].Start).To(Equal(new(int64(4517))))
|
||||
Expect(eng.Line[1].Value).To(Equal("Line two\nwith break"))
|
||||
|
||||
By("parsing the Portuguese track")
|
||||
por := list[1]
|
||||
Expect(por.Lang).To(Equal("por"))
|
||||
Expect(por.Line[0].Start).To(Equal(ptr(int64(4500))))
|
||||
Expect(por.Line[0].Start).To(Equal(new(int64(4500))))
|
||||
Expect(por.Line[0].Value).To(Equal("Linha"))
|
||||
})
|
||||
})
|
||||
@ -58,7 +58,7 @@ var _ = Describe("ParseTTML", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(list).To(HaveLen(1))
|
||||
Expect(list[0].Line).To(HaveLen(1))
|
||||
Expect(list[0].Line[0].Start).To(Equal(ptr(int64(1000))))
|
||||
Expect(list[0].Line[0].Start).To(Equal(new(int64(1000))))
|
||||
Expect(list[0].Line[0].Value).To(Equal("Keep me"))
|
||||
})
|
||||
})
|
||||
@ -80,9 +80,9 @@ var _ = Describe("ParseTTML", func() {
|
||||
Expect(list).To(HaveLen(1))
|
||||
Expect(list[0].Lang).To(Equal("eng"))
|
||||
Expect(list[0].Line).To(HaveLen(2))
|
||||
Expect(list[0].Line[0].Start).To(Equal(ptr(int64(16000))))
|
||||
Expect(list[0].Line[0].Start).To(Equal(new(int64(16000))))
|
||||
Expect(list[0].Line[0].Value).To(Equal("First line"))
|
||||
Expect(list[0].Line[1].Start).To(Equal(ptr(int64(18000))))
|
||||
Expect(list[0].Line[1].Start).To(Equal(new(int64(18000))))
|
||||
Expect(list[0].Line[1].Value).To(Equal("Second line"))
|
||||
})
|
||||
})
|
||||
@ -103,9 +103,9 @@ var _ = Describe("ParseTTML", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(list).To(HaveLen(1))
|
||||
Expect(list[0].Line).To(HaveLen(2))
|
||||
Expect(list[0].Line[0].Start).To(Equal(ptr(int64(10170))))
|
||||
Expect(list[0].Line[0].Start).To(Equal(new(int64(10170))))
|
||||
Expect(list[0].Line[0].Value).To(Equal("First line"))
|
||||
Expect(list[0].Line[1].Start).To(Equal(ptr(int64(13710))))
|
||||
Expect(list[0].Line[1].Start).To(Equal(new(int64(13710))))
|
||||
Expect(list[0].Line[1].Value).To(Equal("Second line"))
|
||||
})
|
||||
})
|
||||
@ -134,14 +134,14 @@ var _ = Describe("ParseTTML", func() {
|
||||
Expect(list[0].Line).To(HaveLen(1))
|
||||
|
||||
line := list[0].Line[0]
|
||||
Expect(line.Start).To(Equal(ptr(int64(1000))))
|
||||
Expect(line.Start).To(Equal(new(int64(1000))))
|
||||
Expect(line.Value).To(Equal("Hello\necho"))
|
||||
Expect(line.End).To(Equal(ptr(int64(3000))))
|
||||
Expect(line.End).To(Equal(new(int64(3000))))
|
||||
Expect(line.Cue).To(HaveLen(3))
|
||||
|
||||
Expect(line.Cue[0]).To(Equal(Cue{Start: ptr(int64(1000)), End: ptr(int64(1400)), Value: "He", ByteStart: 0, ByteEnd: 1, AgentID: "main"}))
|
||||
Expect(line.Cue[1]).To(Equal(Cue{Start: ptr(int64(1400)), End: ptr(int64(1800)), Value: "llo", ByteStart: 2, ByteEnd: 4, AgentID: "main"}))
|
||||
Expect(line.Cue[2]).To(Equal(Cue{Start: ptr(int64(2000)), End: ptr(int64(2500)), Value: "echo", ByteStart: 6, ByteEnd: 9, AgentID: "__nd_bg__|main"}))
|
||||
Expect(line.Cue[0]).To(Equal(Cue{Start: new(int64(1000)), End: new(int64(1400)), Value: "He", ByteStart: 0, ByteEnd: 1, AgentID: "main"}))
|
||||
Expect(line.Cue[1]).To(Equal(Cue{Start: new(int64(1400)), End: new(int64(1800)), Value: "llo", ByteStart: 2, ByteEnd: 4, AgentID: "main"}))
|
||||
Expect(line.Cue[2]).To(Equal(Cue{Start: new(int64(2000)), End: new(int64(2500)), Value: "echo", ByteStart: 6, ByteEnd: 9, AgentID: "__nd_bg__|main"}))
|
||||
})
|
||||
|
||||
It("should append role tokens exactly instead of using substring matches", func() {
|
||||
@ -289,12 +289,12 @@ var _ = Describe("ParseTTML", func() {
|
||||
Expect(list[0].Line).To(HaveLen(1))
|
||||
|
||||
line := list[0].Line[0]
|
||||
Expect(line.Start).To(Equal(ptr(int64(43444))))
|
||||
Expect(line.Start).To(Equal(new(int64(43444))))
|
||||
Expect(line.Value).To(Equal("go\ngo"))
|
||||
Expect(line.End).To(Equal(ptr(int64(45570))))
|
||||
Expect(line.End).To(Equal(new(int64(45570))))
|
||||
Expect(line.Cue).To(HaveLen(2))
|
||||
Expect(line.Cue[0]).To(Equal(Cue{Start: ptr(int64(43444)), End: ptr(int64(43716)), Value: "go", ByteStart: 0, ByteEnd: 1}))
|
||||
Expect(line.Cue[1]).To(Equal(Cue{Start: ptr(int64(43716)), End: ptr(int64(43887)), Value: "go", ByteStart: 3, ByteEnd: 4}))
|
||||
Expect(line.Cue[0]).To(Equal(Cue{Start: new(int64(43444)), End: new(int64(43716)), Value: "go", ByteStart: 0, ByteEnd: 1}))
|
||||
Expect(line.Cue[1]).To(Equal(Cue{Start: new(int64(43716)), End: new(int64(43887)), Value: "go", ByteStart: 3, ByteEnd: 4}))
|
||||
})
|
||||
})
|
||||
|
||||
@ -364,21 +364,21 @@ var _ = Describe("ParseTTML", func() {
|
||||
Expect(translation.Kind).To(Equal("translation"))
|
||||
Expect(translation.Lang).To(Equal("es"))
|
||||
Expect(translation.Line).To(HaveLen(1))
|
||||
Expect(translation.Line[0].Start).To(Equal(ptr(int64(1000))))
|
||||
Expect(translation.Line[0].Start).To(Equal(new(int64(1000))))
|
||||
Expect(translation.Line[0].Value).To(Equal("Hola"))
|
||||
Expect(translation.Line[0].End).To(Equal(ptr(int64(1500))))
|
||||
Expect(translation.Line[0].End).To(Equal(new(int64(1500))))
|
||||
|
||||
By("checking the pronunciation track")
|
||||
pronunciation := list[2]
|
||||
Expect(pronunciation.Kind).To(Equal("pronunciation"))
|
||||
Expect(pronunciation.Lang).To(Equal("ja-latn"))
|
||||
Expect(pronunciation.Line).To(HaveLen(1))
|
||||
Expect(pronunciation.Line[0].Start).To(Equal(ptr(int64(2000))))
|
||||
Expect(pronunciation.Line[0].Start).To(Equal(new(int64(2000))))
|
||||
Expect(pronunciation.Line[0].Value).To(Equal("konni"))
|
||||
Expect(pronunciation.Line[0].End).To(Equal(ptr(int64(2600))))
|
||||
Expect(pronunciation.Line[0].End).To(Equal(new(int64(2600))))
|
||||
Expect(pronunciation.Line[0].Cue).To(HaveLen(2))
|
||||
Expect(pronunciation.Line[0].Cue[0]).To(Equal(Cue{Start: ptr(int64(2000)), End: ptr(int64(2300)), Value: "ko", ByteStart: 0, ByteEnd: 1}))
|
||||
Expect(pronunciation.Line[0].Cue[1]).To(Equal(Cue{Start: ptr(int64(2300)), End: ptr(int64(2600)), Value: "nni", ByteStart: 2, ByteEnd: 4}))
|
||||
Expect(pronunciation.Line[0].Cue[0]).To(Equal(Cue{Start: new(int64(2000)), End: new(int64(2300)), Value: "ko", ByteStart: 0, ByteEnd: 1}))
|
||||
Expect(pronunciation.Line[0].Cue[1]).To(Equal(Cue{Start: new(int64(2300)), End: new(int64(2600)), Value: "nni", ByteStart: 2, ByteEnd: 4}))
|
||||
})
|
||||
})
|
||||
|
||||
@ -418,12 +418,12 @@ var _ = Describe("ParseTTML", func() {
|
||||
Expect(pronunciation.Line).To(HaveLen(1))
|
||||
|
||||
line := pronunciation.Line[0]
|
||||
Expect(line.Start).To(Equal(ptr(int64(2747))))
|
||||
Expect(line.Start).To(Equal(new(int64(2747))))
|
||||
Expect(line.Value).To(Equal("I woke up"))
|
||||
Expect(line.Cue).To(HaveLen(3))
|
||||
Expect(line.Cue[0]).To(Equal(Cue{Start: ptr(int64(2747)), End: ptr(int64(3018)), Value: "I", ByteStart: 0, ByteEnd: 0}))
|
||||
Expect(line.Cue[1]).To(Equal(Cue{Start: ptr(int64(3018)), End: ptr(int64(3179)), Value: "woke", ByteStart: 2, ByteEnd: 5}))
|
||||
Expect(line.Cue[2]).To(Equal(Cue{Start: ptr(int64(3179)), End: ptr(int64(3582)), Value: "up", ByteStart: 7, ByteEnd: 8}))
|
||||
Expect(line.Cue[0]).To(Equal(Cue{Start: new(int64(2747)), End: new(int64(3018)), Value: "I", ByteStart: 0, ByteEnd: 0}))
|
||||
Expect(line.Cue[1]).To(Equal(Cue{Start: new(int64(3018)), End: new(int64(3179)), Value: "woke", ByteStart: 2, ByteEnd: 5}))
|
||||
Expect(line.Cue[2]).To(Equal(Cue{Start: new(int64(3179)), End: new(int64(3582)), Value: "up", ByteStart: 7, ByteEnd: 8}))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -136,7 +136,7 @@ var _ = Describe("ToMediaFile", func() {
|
||||
{
|
||||
Kind: "main",
|
||||
Lang: "eng",
|
||||
Line: []model.Line{{Start: ptr(int64(1000)), End: ptr(int64(2500)), Value: "Embedded TTML line"}},
|
||||
Line: []model.Line{{Start: new(int64(1000)), End: new(int64(2500)), Value: "Embedded TTML line"}},
|
||||
Synced: true,
|
||||
},
|
||||
}))
|
||||
@ -174,7 +174,7 @@ var _ = Describe("ToMediaFile", func() {
|
||||
Expect(actual[0].Kind).To(Equal("main"))
|
||||
Expect(actual[0].Lang).To(Equal("en"))
|
||||
Expect(actual[0].Line).To(Equal([]model.Line{
|
||||
{Start: ptr(int64(1000)), End: ptr(int64(2500)), Value: "Long embedded TTML line"},
|
||||
{Start: new(int64(1000)), End: new(int64(2500)), Value: "Long embedded TTML line"},
|
||||
}))
|
||||
})
|
||||
|
||||
@ -192,7 +192,7 @@ Estamos nas legendas`},
|
||||
{
|
||||
Lang: "por",
|
||||
Line: []model.Line{
|
||||
{Start: ptr(int64(18800)), End: ptr(int64(22800)), Value: "Estamos nas legendas"},
|
||||
{Start: new(int64(18800)), End: new(int64(22800)), Value: "Estamos nas legendas"},
|
||||
},
|
||||
Synced: true,
|
||||
},
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
package metadata_test
|
||||
|
||||
func ptr[T any](v T) *T {
|
||||
return &v
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user