33 lines
543 B
Go
33 lines
543 B
Go
package csexp_test
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"git.codemonkeysoftware.net/b/peachy-go/csexp"
|
|
)
|
|
|
|
func ExampleSexp_WriteTo() {
|
|
var sexp csexp.Sexp = csexp.List{
|
|
csexp.Atom("Hello,"),
|
|
csexp.List{
|
|
csexp.Atom("Mr."),
|
|
csexp.Atom("Rivest."),
|
|
},
|
|
}
|
|
sexp.WriteTo(os.Stdout)
|
|
// Output: (6:Hello,(3:Mr.7:Rivest.))
|
|
}
|
|
|
|
func ExampleSexp_String() {
|
|
var sexp csexp.Sexp = csexp.List{
|
|
csexp.Atom("Hello,"),
|
|
csexp.List{
|
|
csexp.Atom("Mr."),
|
|
csexp.Atom("Rivest."),
|
|
},
|
|
}
|
|
fmt.Print(sexp.String())
|
|
// Output: (6:Hello,(3:Mr.7:Rivest.))
|
|
}
|