Skip to content

Commit

Permalink
Merge pull request #33 from codecrafters-io/update-test-programs-read
Browse files Browse the repository at this point in the history
Use TESTER_DIR instead of runtime.Caller
  • Loading branch information
rohitpaulk authored Aug 23, 2024
2 parents 9c9edeb + 52cece9 commit f827712
Show file tree
Hide file tree
Showing 42 changed files with 2 additions and 6 deletions.
7 changes: 1 addition & 6 deletions internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"os"
"path/filepath"
"regexp"
"runtime"
"strings"

"github.com/codecrafters-io/tester-utils/random"
Expand Down Expand Up @@ -34,12 +33,8 @@ func getRandBoolean() string {
func GetTestProgramsForCurrentStage(stageIdentifier string) []string {
var testPrograms []string

// Get the directory of the current file
_, currentFilePath, _, _ := runtime.Caller(2)
currentDir := filepath.Dir(currentFilePath)

// Construct the path to the test_programs directory
parentDir := filepath.Join(currentDir, "test_programs")
parentDir := filepath.Join(os.Getenv("TESTER_DIR"), "test_programs")
testDir := filepath.Join(parentDir, stageIdentifier)
files, err := os.ReadDir(testDir)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions main.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ archives:
format: tar.gz
files:
- test.sh
- test_programs/**/*
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f827712

Please sign in to comment.