From adcbc5f7b25fd9ed50bb20b00387e6a89f0b6a6a Mon Sep 17 00:00:00 2001 From: devlights Date: Mon, 13 May 2024 02:24:42 +0000 Subject: [PATCH] Add Results in example --- examples/basic/xmlop/README.md | 16 ++++++++-------- examples/basic/xmlop/decoder.go | 15 +++++++++++++++ examples/basic/xmlop/encoder.go | 16 ++++++++++++++++ examples/basic/xmlop/marshal.go | 16 ++++++++++++++++ examples/basic/xmlop/marshal_indent.go | 25 +++++++++++++++++++++++++ examples/basic/xmlop/nestedelements.go | 16 ++++++++++++++++ examples/basic/xmlop/unmarshal.go | 15 +++++++++++++++ 7 files changed, 111 insertions(+), 8 deletions(-) diff --git a/examples/basic/xmlop/README.md b/examples/basic/xmlop/README.md index a0cfff6d..2b4dd8a7 100644 --- a/examples/basic/xmlop/README.md +++ b/examples/basic/xmlop/README.md @@ -2,13 +2,13 @@ このディレクトリには以下のサンプルがあります。 -| file | example name | note | -|-------------------|-----------------------|----------------------------------| -| marshal.go | xml\_marshal | xml.Marshal() についてのサンプルです. | -| marshal_indent.go | xml\_marshal\_indent | xml.MarshalIndent() についてのサンプルです. | -| unmarshal.go | xml\_unmarshal | xml.Unmarshal() についてのサンプルです. | -| decoder.go | xml\_decoder | xml.Decoder についてのサンプルです. | -| encoder.go | xml\_encoder | xml.Encoder についてのサンプルです. | -| nestedelements.go | xml\_nested\_elements | 入れ子になっている要素を取得するサンプルです | +| file | example name | note | +| ----------------- | ------------------- | -------------------------------------------- | +| marshal.go | xml_marshal | xml.Marshal() についてのサンプルです. | +| marshal_indent.go | xml_marshal_indent | xml.MarshalIndent() についてのサンプルです. | +| unmarshal.go | xml_unmarshal | xml.Unmarshal() についてのサンプルです. | +| decoder.go | xml_decoder | xml.Decoder についてのサンプルです. | +| encoder.go | xml_encoder | xml.Encoder についてのサンプルです. | +| nestedelements.go | xml_nested_elements | 入れ子になっている要素を取得するサンプルです | エンコーディングが UTF-8 ではないXMLファイルのUnmarshalについては examples/singleapp/xml_shiftjisを参照。 diff --git a/examples/basic/xmlop/decoder.go b/examples/basic/xmlop/decoder.go index 11238f1f..b041cc3b 100644 --- a/examples/basic/xmlop/decoder.go +++ b/examples/basic/xmlop/decoder.go @@ -41,4 +41,19 @@ func Decoder() error { output.Stdoutf("[decoder]", "%v\n", v) return nil + + /* + $ task + task: [build] go build . + task: [run] ./try-golang -onetime + + ENTER EXAMPLE NAME: xml_decoder + + [Name] "xml_decoder" + [decoder] {{ data} [{golang fmt.Println {1 16}} {java System.out.println {16 0}}]} + + + [Elapsed] 106.5µs + */ + } diff --git a/examples/basic/xmlop/encoder.go b/examples/basic/xmlop/encoder.go index 4ae2c7a9..8d9c2b35 100644 --- a/examples/basic/xmlop/encoder.go +++ b/examples/basic/xmlop/encoder.go @@ -32,4 +32,20 @@ func Encoder() error { output.Stdoutf("[encoder]", "\n%s\n", buf.String()) return nil + + /* + $ task + task: [build] go build . + task: [run] ./try-golang -onetime + + ENTER EXAMPLE NAME: xml_encoder + + [Name] "xml_encoder" + [encoder] + fmt.PrintlnSystem.out.println + + + [Elapsed] 80.37µs + */ + } diff --git a/examples/basic/xmlop/marshal.go b/examples/basic/xmlop/marshal.go index 136136b7..98162ef8 100644 --- a/examples/basic/xmlop/marshal.go +++ b/examples/basic/xmlop/marshal.go @@ -29,4 +29,20 @@ func Marshal() error { output.Stdoutf("[marshal]", "\n%s\n", string(buf)) return nil + + /* + $ task + task: Task "build" is up to date + task: [run] ./try-golang -onetime + + ENTER EXAMPLE NAME: xml_marshal + + [Name] "xml_marshal" + [marshal] + fmt.PrintlnSystem.out.println + + + [Elapsed] 93.3µs + */ + } diff --git a/examples/basic/xmlop/marshal_indent.go b/examples/basic/xmlop/marshal_indent.go index b72df093..93be7129 100644 --- a/examples/basic/xmlop/marshal_indent.go +++ b/examples/basic/xmlop/marshal_indent.go @@ -30,4 +30,29 @@ func MarshalIndent() error { output.Stdoutf("[marshal]", "\n%s\n", string(buf)) return nil + + /* + $ task + task: [build] go build . + task: [run] ./try-golang -onetime + + ENTER EXAMPLE NAME: xml_marshal_indent + + [Name] "xml_marshal_indent" + [marshal] + + + fmt.Println + + + + System.out.println + + + + + + [Elapsed] 104.73µs + */ + } diff --git a/examples/basic/xmlop/nestedelements.go b/examples/basic/xmlop/nestedelements.go index e30e5f86..4da068be 100644 --- a/examples/basic/xmlop/nestedelements.go +++ b/examples/basic/xmlop/nestedelements.go @@ -45,4 +45,20 @@ func NestedElements() error { } return nil + + /* + $ task + task: [build] go build . + task: [run] ./try-golang -onetime + + ENTER EXAMPLE NAME: xml_nested_elements + + [Name] "xml_nested_elements" + [result] hello + [result] world + + + [Elapsed] 54.25µs + */ + } diff --git a/examples/basic/xmlop/unmarshal.go b/examples/basic/xmlop/unmarshal.go index 9b9a9ec2..5fef4582 100644 --- a/examples/basic/xmlop/unmarshal.go +++ b/examples/basic/xmlop/unmarshal.go @@ -37,4 +37,19 @@ func Unmarshal() error { output.Stdoutf("[unmarshal]", "%v\n", v) return nil + + /* + $ task + task: [build] go build . + task: [run] ./try-golang -onetime + + ENTER EXAMPLE NAME: xml_unmarshal + + [Name] "xml_unmarshal" + [unmarshal] {{ data} [{golang fmt.Println {1 16}} {java System.out.println {16 0}}]} + + + [Elapsed] 96.249µs + */ + }