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
461 B

package main
import (
"os"
"os/exec"
"lib"
)
var oldName = "printprogramname"
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("€")
}