streaming

Media streaming and broadcast systems in Go
Log | Files | Refs | README | LICENSE

lex_test.go (463B)


      1 package m3u8
      2 
      3 import (
      4 	"os"
      5 	"path"
      6 	"testing"
      7 )
      8 
      9 func TestLex(t *testing.T) {
     10 	files := []string{"testdata/master.m3u8"}
     11 	for _, name := range files {
     12 		fname := path.Base(name)
     13 		t.Run(fname, func(t *testing.T) {
     14 			f, err := os.Open(name)
     15 			if err != nil {
     16 				t.Fatal(err)
     17 			}
     18 			defer f.Close()
     19 			lexer := newLexer(f)
     20 			go lexer.run()
     21 			for it := range lexer.items {
     22 				t.Log(it)
     23 				if it.typ == itemError {
     24 					t.Error(it.val)
     25 				}
     26 			}
     27 		})
     28 	}
     29 }