Beispiel #1
0
func prettyPrintObject(o otm.Object, log *testing.T) {
	parent := ""
	for x := o.Parent(); !fn.IsNil(x); x = x.Parent() {
		parent = fmt.Sprint(x.Qualident(), "<-", parent)
	}
	log.Log(parent, o.Qualident())
	if o.ChildrenCount() > 0 {
		log.Log(":")
		for _x := range o.Children() {
			switch x := _x.(type) {
			case otm.Object:
				prettyPrintObject(x, log)
			case otm.Link:
				log.Log("@", x.Object().Qualident())
			case string, float64, int64, rune, tri.Trit:
				log.Log(_x)
			case []uint8:
				s := zbase32.EncodeToString(x)
				log.Log("zbase32(", s, ")", x)
			default:
				halt.As(100, reflect.TypeOf(x))
			}
		}
		log.Log(";")
	}
}