Skip to content

🧪 Make TestNew_variableNames hermetic #87

Description

@ccamel

Summary

TestNew_variableNames uses the literal filename f and manually removes it in interpreter_test.go:285-294; its open(f, ...) cases appear at interpreter_test.go:361-371. The test can therefore affect the repository root and depend on its filesystem state.

Why it matters

Tests must be isolated from the checkout and safe for concurrent or interrupted execution.

Scope

Call t.Chdir(t.TempDir()) in TestNew_variableNames and remove the manual os.Remove("f") cleanup.

Acceptance criteria

  • TestNew_variableNames runs with its working directory set to a test-local temporary directory.
  • The test no longer manually removes f.
  • The test still passes.
  • Running the test produces no root-level f file.

Verification

Run go test . -run '^TestNew_variableNames$' and confirm the repository root contains no f after the test finishes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions