You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
482 B

package main
import (
"os"
"os/exec"
"github.com/01-edu/public/go/tests/lib"
)
var oldName = "exe"
func test(name string) {
if err := os.Rename(oldName, name); err != nil {
lib.Fatalln(err)
}
b, err := exec.Command("./" + name).CombinedOutput()
if err != nil {
lib.Fatalln(err)
}
if string(b) != name+"\n" {
lib.Fatalln("Failed to print the program name :", string(b))
}
oldName = name
}
func main() {
test("choumi")
test("🤦🏻")
test("€")
}