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.

31 lines
461 B

package main
import (
"os"
"os/exec"
"lib"
)
5 years ago
var oldName = "printprogramname"
5 years ago
func test(name string) {
if err := os.Rename(oldName, name); err != nil {
lib.Fatalln(err)
}
b, err := exec.Command("./" + name).CombinedOutput()
if err != nil {
5 years ago
lib.Fatalln(err)
}
if string(b) != name+"\n" {
5 years ago
lib.Fatalln("Failed to print the program name :", string(b))
}
5 years ago
oldName = name
}
func main() {
test("choumi")
test("🤦🏻")
test("€")
}