refactor: Add support for parsing 翔鹏航空 (8L) flight schedule data
This commit is contained in:
@@ -221,6 +221,21 @@ var (
|
||||
4: Register,
|
||||
},
|
||||
},
|
||||
{
|
||||
/**
|
||||
* 翔鹏航空 (8L)
|
||||
*L59 W/Z 8L9976 B6959 TSN/0510 CTU/0855 KMG
|
||||
*/
|
||||
Airlines: []string{"8L"},
|
||||
MinLen: 6,
|
||||
WaypointStart: 4,
|
||||
Fields: map[int]string{
|
||||
0: Index,
|
||||
1: Task,
|
||||
2: FlightNumber,
|
||||
3: Register,
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -444,4 +444,25 @@ var _ = Describe("Parse Line with PreDef", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Context("8L", func() {
|
||||
It("L59 W/Z 8L9976 B6959 TSN/0510 CTU/0855 KMG", func() {
|
||||
lineText := "L59 W/Z 8L9976 B6959 TSN/0510 CTU/0855 KMG"
|
||||
def := FindDef("8L")
|
||||
Expect(def).NotTo(BeNil())
|
||||
schedule := ParseWithDef(lineText, def)
|
||||
Expect(schedule).NotTo(BeNil())
|
||||
Expect(schedule.Index).To(Equal("L59"))
|
||||
Expect(schedule.Task).To(Equal("W/Z"))
|
||||
Expect(len(schedule.FlightNumber)).To(Equal(1))
|
||||
Expect(schedule.FlightNumber[0]).To(Equal("8L9976"))
|
||||
Expect(schedule.AircraftReg).To(Equal("B6959"))
|
||||
Expect(len(schedule.Waypoints)).To(Equal(3))
|
||||
Expect(schedule.Waypoints[0].Airport).To(Equal("TSN"))
|
||||
Expect(schedule.Waypoints[0].DepartureTime).To(Equal("0510"))
|
||||
Expect(schedule.Waypoints[1].Airport).To(Equal("CTU"))
|
||||
Expect(schedule.Waypoints[1].DepartureTime).To(Equal("0855"))
|
||||
Expect(schedule.Waypoints[2].Airport).To(Equal("KMG"))
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user