-
Notifications
You must be signed in to change notification settings - Fork 3
/
parser_test.go
35 lines (30 loc) · 951 Bytes
/
parser_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright (c) 2020 Engin Yöyen.
* Use of this source code is governed by an MIT
* license that can be found in the LICENSE file.
*/
package aslparser
import (
"os"
"path/filepath"
"testing"
)
func TestParse(t *testing.T) {
wd, err := os.Getwd()
if err != nil {
panic(err.Error())
}
wd = filepath.Join(wd, "testdata", "definitions")
unreachableState := filepath.Join(wd, "invalid-unreachable-state.json")
inexistantState := filepath.Join(wd, "invalid-inexistant-state.json")
//jsonPath := filepath.Join(wd, "invalid-json-path.json")
runInvalidParseCase(t, unreachableState, "unreachable-state")
runInvalidParseCase(t, inexistantState, "inexistant-state")
//runInvalidParseCase(t, jsonPath,"json-path")
}
func runInvalidParseCase(t *testing.T, path string, name string) {
stateMachine, _ := ParseFile(path, true)
if stateMachine.Valid() {
t.Errorf("Validation passed, where as suppose to fail for input %s", name)
}
}