diff --git a/pkg/testing/loader_file.go b/pkg/testing/loader_file.go index 5921580..582b36b 100644 --- a/pkg/testing/loader_file.go +++ b/pkg/testing/loader_file.go @@ -1,5 +1,5 @@ /* -Copyright 2023 API Testing Authors. +Copyright 2023-2024 API Testing Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -124,7 +124,7 @@ func (l *fileLoader) Put(item string) (err error) { defer l.lock.Unlock() if l.parent == "" { - l.parent = path.Dir(item) + l.parent = filepath.Dir(item) } if strings.HasPrefix(item, "http://") || strings.HasPrefix(item, "https://") { @@ -144,7 +144,7 @@ func (l *fileLoader) Put(item string) (err error) { // GetContext returns the context of current test case func (l *fileLoader) GetContext() string { - return path.Dir(l.paths[l.index]) + return filepath.Dir(l.paths[l.index]) } // GetCount returns the count of test cases @@ -207,7 +207,7 @@ func (l *fileLoader) CreateSuite(name, api string) (err error) { err = fmt.Errorf("suite %s already exists", name) } else { if l.parent == "" { - l.parent = path.Dir(absPath) + l.parent = filepath.Dir(absPath) } if err = os.MkdirAll(l.parent, 0755); err != nil { diff --git a/pkg/testing/parser_test.go b/pkg/testing/parser_test.go index 1a1e21b..cd93730 100644 --- a/pkg/testing/parser_test.go +++ b/pkg/testing/parser_test.go @@ -1,5 +1,5 @@ /* -Copyright 2023 API Testing Authors. +Copyright 2023-2024 API Testing Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import ( "io" "net/http" "os" - "strings" "testing" _ "embed" @@ -36,9 +35,6 @@ func TestParse(t *testing.T) { return } - // make sure the sample file contains the header - assert.True(t, strings.HasPrefix(string(data), atest.GetHeader())) - suite, err := atest.Parse(data) if assert.Nil(t, err) && assert.NotNil(t, suite) { assert.Equal(t, "Gitlab", suite.Name)