aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-05-26 03:07:51 +0700
committerShulhan <ms@kilabit.info>2019-05-26 03:07:51 +0700
commitc9ceaece557a117b0962710d1523d8dec35811d8 (patch)
treeb8dda3de259062f5062ef876cfda82a6a5f8fe5c
parent9bc7afd4e748627d28f267cbebb5d19a92a7c407 (diff)
downloadpakakeh.go-c9ceaece557a117b0962710d1523d8dec35811d8.tar.xz
ini: remove unused cases in variable's String
The lineModeSection and lineModeSubsection on variable's String switch cases is previously used to print section and/or subsection before the section is moved to its own type.
-rw-r--r--lib/ini/variable.go24
-rw-r--r--lib/ini/variable_test.go41
2 files changed, 0 insertions, 65 deletions
diff --git a/lib/ini/variable.go b/lib/ini/variable.go
index dbc20eff..ab85f992 100644
--- a/lib/ini/variable.go
+++ b/lib/ini/variable.go
@@ -50,30 +50,6 @@ func (v *variable) String() string {
} else {
_, _ = fmt.Fprintf(&buf, "%s\n", v.others)
}
- case lineModeSection:
- if len(v.format) > 0 {
- _, _ = fmt.Fprintf(&buf, v.format, v.secName)
- } else {
- _, _ = fmt.Fprintf(&buf, "[%s]\n", v.secName)
- }
- case lineModeSection | lineModeComment:
- if len(v.format) > 0 {
- _, _ = fmt.Fprintf(&buf, v.format, v.secName, v.others)
- } else {
- _, _ = fmt.Fprintf(&buf, "[%s] %s\n", v.secName, v.others)
- }
- case lineModeSection | lineModeSubsection:
- if len(v.format) > 0 {
- _, _ = fmt.Fprintf(&buf, v.format, v.secName, v.subName)
- } else {
- _, _ = fmt.Fprintf(&buf, `[%s "%s"]\n`, v.secName, v.subName)
- }
- case lineModeSection | lineModeSubsection | lineModeComment:
- if len(v.format) > 0 {
- _, _ = fmt.Fprintf(&buf, v.format, v.secName, v.subName, v.others)
- } else {
- _, _ = fmt.Fprintf(&buf, `[%s "%s"] %s\n`, v.secName, v.subName, v.others)
- }
case lineModeSingle:
if len(v.format) > 0 {
_, _ = fmt.Fprintf(&buf, v.format, v.key)
diff --git a/lib/ini/variable_test.go b/lib/ini/variable_test.go
index d881d3a5..a23738b2 100644
--- a/lib/ini/variable_test.go
+++ b/lib/ini/variable_test.go
@@ -43,47 +43,6 @@ func TestVariableString(t *testing.T) {
},
exp: "; comment\n",
}, {
- desc: "With mode section",
- v: &variable{
- mode: lineModeSection,
- secName: "section",
- },
- exp: "[section]\n",
- }, {
- desc: "With mode section and comment #1",
- v: &variable{
- mode: lineModeSection | lineModeComment,
- secName: "section",
- others: "; comment",
- },
- exp: "[section] ; comment\n",
- }, {
- desc: "With mode section and comment #2",
- v: &variable{
- mode: lineModeSection | lineModeComment,
- format: " [%s] %s",
- secName: "section",
- others: "; comment",
- },
- exp: " [section] ; comment",
- }, {
- desc: "With mode section and subsection",
- v: &variable{
- mode: lineModeSection | lineModeSubsection,
- secName: "section",
- subName: "subsection",
- },
- exp: `[section "subsection"]\n`,
- }, {
- desc: "With mode section, subsection, and comment",
- v: &variable{
- mode: lineModeSection | lineModeSubsection | lineModeComment,
- secName: "section",
- subName: "subsection",
- others: "; comment",
- },
- exp: `[section "subsection"] ; comment\n`,
- }, {
desc: "With mode single",
v: &variable{
mode: lineModeSingle,