mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
feature: Fix #4421: Add `-C DIR` flag Signed-off-by: Roger Standridge <9526806+archie2x@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
/*
|
||||
Test that this program is 'run' in expected directory. 'run' with expected
|
||||
working-directory in 'EXPECT_DIR' environment variable' with{,out} a -C
|
||||
argument.
|
||||
*/
|
||||
func main() {
|
||||
expectDir := os.Getenv("EXPECT_DIR")
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
cwd = filepath.ToSlash(cwd)
|
||||
}
|
||||
if cwd != expectDir {
|
||||
log.Fatalf("expected:\"%v\" != os.Getwd():\"%v\"", expectDir, cwd)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user