cue: add another example

Change-Id: I5a3fb5ab471cd0ada6382e63085865bea9145be3
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2877
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/examples_test.go b/cue/examples_test.go
index f9922e9..d065e87 100644
--- a/cue/examples_test.go
+++ b/cue/examples_test.go
@@ -23,23 +23,44 @@
 func ExampleRuntime_Parse() {
 	const config = `
 	msg:   "Hello \(place)!"
-	place: "world"
+	place: string | *"world"
 	`
 
 	var r cue.Runtime
 
-	instance, err := r.Parse("test", config)
+	instance, err := r.Compile("test", config)
 	if err != nil {
 		// handle error
 	}
 
-	str, err := instance.Lookup("msg").String()
-	if err != nil {
-		// handle error
-	}
+	str, _ := instance.Lookup("msg").String()
+	fmt.Println(str)
 
+	instance, _ = instance.Fill("you", "place")
+	str, _ = instance.Lookup("msg").String()
 	fmt.Println(str)
 
 	// Output:
 	// Hello world!
+	// Hello you!
+}
+
+func ExampleValue_Decode() {
+	type ab struct{ A, B int }
+
+	var x ab
+
+	var r cue.Runtime
+
+	i, _ := r.Compile("test", `{A: 2, B: 4}`)
+	_ = i.Value().Decode(&x)
+	fmt.Println(x)
+
+	i, _ = r.Compile("test", `{B: "foo"}`)
+	err := i.Value().Decode(&x)
+	fmt.Println(err)
+
+	// Output:
+	// {2 4}
+	// json: cannot unmarshal string into Go struct field ab.B of type int
 }