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.

32 lines
482 B

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