mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 12:12:12 +08:00
fix: update test file paths to use testdata directory
This commit is contained in:
parent
55ceb53bd4
commit
690ecda6e6
@ -11,7 +11,7 @@ import (
|
|||||||
// TestContextFileSimple tests the Context.File() method with a simple case
|
// TestContextFileSimple tests the Context.File() method with a simple case
|
||||||
func TestContextFileSimple(t *testing.T) {
|
func TestContextFileSimple(t *testing.T) {
|
||||||
// Test serving an existing file
|
// Test serving an existing file
|
||||||
testFile := "test_file.txt"
|
testFile := "testdata/test_file.txt"
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
c, _ := CreateTestContext(w)
|
c, _ := CreateTestContext(w)
|
||||||
c.Request = httptest.NewRequest(http.MethodGet, "/test", nil)
|
c.Request = httptest.NewRequest(http.MethodGet, "/test", nil)
|
||||||
|
@ -80,7 +80,7 @@ func TestContextFile(t *testing.T) {
|
|||||||
// Test serving an existing file
|
// Test serving an existing file
|
||||||
t.Run("serve existing file", func(t *testing.T) {
|
t.Run("serve existing file", func(t *testing.T) {
|
||||||
// Create a temporary test file
|
// Create a temporary test file
|
||||||
testFile := "test_file.txt"
|
testFile := "testdata/test_file.txt"
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
c, _ := CreateTestContext(w)
|
c, _ := CreateTestContext(w)
|
||||||
@ -118,7 +118,7 @@ func TestContextFile(t *testing.T) {
|
|||||||
|
|
||||||
// Test with HEAD request
|
// Test with HEAD request
|
||||||
t.Run("HEAD request", func(t *testing.T) {
|
t.Run("HEAD request", func(t *testing.T) {
|
||||||
testFile := "test_file.txt"
|
testFile := "testdata/test_file.txt"
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
c, _ := CreateTestContext(w)
|
c, _ := CreateTestContext(w)
|
||||||
@ -133,7 +133,7 @@ func TestContextFile(t *testing.T) {
|
|||||||
|
|
||||||
// Test with Range request
|
// Test with Range request
|
||||||
t.Run("Range request", func(t *testing.T) {
|
t.Run("Range request", func(t *testing.T) {
|
||||||
testFile := "test_file.txt"
|
testFile := "testdata/test_file.txt"
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
c, _ := CreateTestContext(w)
|
c, _ := CreateTestContext(w)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user