Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/testing/loader_file.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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://") {
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 1 addition & 5 deletions pkg/testing/parser_test.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -20,7 +20,6 @@ import (
"io"
"net/http"
"os"
"strings"
"testing"

_ "embed"
Expand All @@ -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)
Expand Down