refactor tests
diff --git a/read_test.go b/read_test.go
index fbc5acf..7e58cab 100644
--- a/read_test.go
+++ b/read_test.go
@@ -15,17 +15,23 @@
 	sp4096 = sp512 + sp512 + sp512 + sp512 + sp512 + sp512 + sp512 + sp512
 )
 
-type sect01 struct{ Name string }
-type conf01 struct{ Section sect01 }
+type cBasic struct {
+	Section           cBasicS1
+	Hyphen_In_Section cBasicS2
+}
+type cBasicS1 struct {
+	Name string
+	Int  int
+}
+type cBasicS2 struct {
+	Hyphen_In_Name string
+}
 
-type sect02 struct{ Bool bool }
-type conf02 struct{ Section sect02 }
+type cSubs struct{ Sub map[string]*cSubsS1 }
+type cSubsS1 struct{ Name string }
 
-type sect03 struct{ Hyphen_In_Name string }
-type conf03 struct{ Hyphen_In_Section sect03 }
-
-type sect04 struct{ Name string }
-type conf04 struct{ Sub map[string]*sect04 }
+type cBool struct{ Section cBoolS1 }
+type cBoolS1 struct{ Bool bool }
 
 type readtest struct {
 	gcfg string
@@ -38,108 +44,110 @@
 	tests []readtest
 }{{"basic", []readtest{
 	// string value
-	{"[section]\nname=value", &conf01{sect01{"value"}}, true},
-	{"[section]\nname=", &conf01{sect01{""}}, true},
+	{"[section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\nname=", &cBasic{Section: cBasicS1{Name: ""}}, true},
 	// non-string value
-	{"[section]\nbool=true", &conf02{sect02{true}}, true},
-	// default value (true)
-	{"[section]\nbool", &conf02{sect02{true}}, true},
+	{"[section]\nint=1", &cBasic{Section: cBasicS1{Int: 1}}, true},
 	// hyphen in name
-	{"[hyphen-in-section]\nhyphen-in-name=value", &conf03{sect03{"value"}}, true},
+	{"[hyphen-in-section]\nhyphen-in-name=value", &cBasic{Hyphen_In_Section: cBasicS2{"value"}}, true},
 	// quoted string value
-	{"[section]\nname=\"\"", &conf01{sect01{""}}, true},
-	{"[section]\nname=\" \"", &conf01{sect01{" "}}, true},
-	{"[section]\nname=\"value\"", &conf01{sect01{"value"}}, true},
-	{"[section]\nname=\" value \"", &conf01{sect01{" value "}}, true},
-	{"\n[section]\nname=\"value ; cmnt\"", &conf01{sect01{"value ; cmnt"}}, true},
-	{"[section]\nname=\"val\" \"ue\"", &conf01{sect01{"val ue"}}, true},
+	{"[section]\nname=\"\"", &cBasic{Section: cBasicS1{Name: ""}}, true},
+	{"[section]\nname=\" \"", &cBasic{Section: cBasicS1{Name: " "}}, true},
+	{"[section]\nname=\"value\"", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\nname=\" value \"", &cBasic{Section: cBasicS1{Name: " value "}}, true},
+	{"\n[section]\nname=\"va ; lue\"", &cBasic{Section: cBasicS1{Name: "va ; lue"}}, true},
+	{"[section]\nname=\"val\" \"ue\"", &cBasic{Section: cBasicS1{Name: "val ue"}}, true},
 	// escape sequences
-	{"[section]\nname=\"va\\\\lue\"", &conf01{sect01{"va\\lue"}}, true},
-	{"[section]\nname=\"va\\\"lue\"", &conf01{sect01{"va\"lue"}}, true},
-	{"[section]\nname=\"va\\nlue\"", &conf01{sect01{"va\nlue"}}, true},
-	{"[section]\nname=\"va\\tlue\"", &conf01{sect01{"va\tlue"}}, true},
+	{"[section]\nname=\"va\\\\lue\"", &cBasic{Section: cBasicS1{Name: "va\\lue"}}, true},
+	{"[section]\nname=\"va\\\"lue\"", &cBasic{Section: cBasicS1{Name: "va\"lue"}}, true},
+	{"[section]\nname=\"va\\nlue\"", &cBasic{Section: cBasicS1{Name: "va\nlue"}}, true},
+	{"[section]\nname=\"va\\tlue\"", &cBasic{Section: cBasicS1{Name: "va\tlue"}}, true},
 	// broken line
-	{"[section]\nname=value \\\n value", &conf01{sect01{"value  value"}}, true},
-	// long lines
-	{sp4096 + "[section]\nname=value\n", &conf01{sect01{"value"}}, true},
-	{"[" + sp4096 + "section]\nname=value\n", &conf01{sect01{"value"}}, true},
-	{"[section" + sp4096 + "]\nname=value\n", &conf01{sect01{"value"}}, true},
-	{"[section]" + sp4096 + "\nname=value\n", &conf01{sect01{"value"}}, true},
-	{"[section]\n" + sp4096 + "name=value\n", &conf01{sect01{"value"}}, true},
-	{"[section]\nname" + sp4096 + "=value\n", &conf01{sect01{"value"}}, true},
-	{"[section]\nname=" + sp4096 + "value\n", &conf01{sect01{"value"}}, true},
-	{"[section]\nname=value\n" + sp4096, &conf01{sect01{"value"}}, true},
-}}, {"bool", []readtest{
-	{"[section]\nbool=true", &conf02{sect02{true}}, true},
-	{"[section]\nbool=yes", &conf02{sect02{true}}, true},
-	{"[section]\nbool=on", &conf02{sect02{true}}, true},
-	{"[section]\nbool=1", &conf02{sect02{true}}, true},
-	{"[section]\nbool=false", &conf02{sect02{false}}, true},
-	{"[section]\nbool=no", &conf02{sect02{false}}, true},
-	{"[section]\nbool=off", &conf02{sect02{false}}, true},
-	{"[section]\nbool=0", &conf02{sect02{false}}, true},
-	{"[section]\nbool=t", &conf02{}, false},
-	{"[section]\nbool=truer", &conf02{}, false},
-	{"[section]\nbool=-1", &conf02{}, false},
+	{"[section]\nname=value \\\n value", &cBasic{Section: cBasicS1{Name: "value  value"}}, true},
 }}, {"whitespace", []readtest{
-	{" \n[section]\nbool=true", &conf02{sect02{true}}, true},
-	{" [section]\nbool=true", &conf02{sect02{true}}, true},
-	{"\t[section]\nbool=true", &conf02{sect02{true}}, true},
-	{"[ section]\nbool=true", &conf02{sect02{true}}, true},
-	{"[section ]\nbool=true", &conf02{sect02{true}}, true},
-	{"[section]\n bool=true", &conf02{sect02{true}}, true},
-	{"[section]\nbool =true", &conf02{sect02{true}}, true},
-	{"[section]\nbool= true", &conf02{sect02{true}}, true},
-	{"[section]\nbool=true ", &conf02{sect02{true}}, true},
-	{"[section]\r\nbool=true", &conf02{sect02{true}}, true},
-	{"[section]\r\nbool=true\r\n", &conf02{sect02{true}}, true},
-	{";cmnt\r\n[section]\r\nbool=true\r\n", &conf02{sect02{true}}, true},
+	{" \n[section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{" [section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\t[section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[ section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section ]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\n name=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\nname =value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\nname= value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\nname=value ", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\r\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\r\nname=value\r\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{";cmnt\r\n[section]\r\nname=value\r\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	// long lines
+	{sp4096 + "[section]\nname=value\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[" + sp4096 + "section]\nname=value\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section" + sp4096 + "]\nname=value\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]" + sp4096 + "\nname=value\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\n" + sp4096 + "name=value\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\nname" + sp4096 + "=value\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\nname=" + sp4096 + "value\n", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"[section]\nname=value\n" + sp4096, &cBasic{Section: cBasicS1{Name: "value"}}, true},
 }}, {"comments", []readtest{
-	{"; cmnt\n[section]\nname=value", &conf01{sect01{"value"}}, true},
-	{"# cmnt\n[section]\nname=value", &conf01{sect01{"value"}}, true},
-	{" ; cmnt\n[section]\nname=value", &conf01{sect01{"value"}}, true},
-	{"\t; cmnt\n[section]\nname=value", &conf01{sect01{"value"}}, true},
-	{"\n[section]; cmnt\nname=value", &conf01{sect01{"value"}}, true},
-	{"\n[section] ; cmnt\nname=value", &conf01{sect01{"value"}}, true},
-	{"\n[section]\nname=value; cmnt", &conf01{sect01{"value"}}, true},
-	{"\n[section]\nname=value ; cmnt", &conf01{sect01{"value"}}, true},
-	{"\n[section]\nname=\"value\" ; cmnt", &conf01{sect01{"value"}}, true},
-	{"\n[section]\nname=value ; \"cmnt", &conf01{sect01{"value"}}, true},
-	{"\n[section]\nname=\"value ; cmnt\" ; cmnt", &conf01{sect01{"value ; cmnt"}}, true},
-	{"\n[section]\nname=; cmnt", &conf01{sect01{""}}, true},
+	{"; cmnt\n[section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"# cmnt\n[section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{" ; cmnt\n[section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\t; cmnt\n[section]\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\n[section]; cmnt\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\n[section] ; cmnt\nname=value", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\n[section]\nname=value; cmnt", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\n[section]\nname=value ; cmnt", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\n[section]\nname=\"value\" ; cmnt", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\n[section]\nname=value ; \"cmnt", &cBasic{Section: cBasicS1{Name: "value"}}, true},
+	{"\n[section]\nname=\"va ; lue\" ; cmnt", &cBasic{Section: cBasicS1{Name: "va ; lue"}}, true},
+	{"\n[section]\nname=; cmnt", &cBasic{Section: cBasicS1{Name: ""}}, true},
 }}, {"subsections", []readtest{
-	{"\n[sub \"A\"]\nname=value", &conf04{map[string]*sect04{"A": &sect04{"value"}}}, true},
-	{"\n[sub \"b\"]\nname=value", &conf04{map[string]*sect04{"b": &sect04{"value"}}}, true},
-	{"\n[sub \"A\\\\\"]\nname=value", &conf04{map[string]*sect04{"A\\": &sect04{"value"}}}, true},
-	{"\n[sub \"A\\\"\"]\nname=value", &conf04{map[string]*sect04{"A\"": &sect04{"value"}}}, true},
-}}, {"errors", []readtest{
-	// error: invalid line
-	{"\n[section]\n=", &conf01{}, false},
-	// error: no section
-	{"name=value", &conf01{}, false},
-	// error: failed to parse
-	{"\n[section]\nbool=maybe", &conf02{sect02{}}, false},
-	// error: empty section
-	{"\n[]\nname=value", &conf01{}, false},
-	// error: empty subsection
-	{"\n[sub \"\"]\nname=value", &conf04{}, false},
-	// error: section name not matched
-	{"\n[nonexistent]\nname=value", &conf01{}, false},
-	// error: subsection name not matched
-	{"\n[section \"nonexistent\"]\nname=value", &conf01{}, false},
-	// error: variable name not matched
-	{"\n[section]\nnonexistent=value", &conf01{}, false},
-	// error: missing end quote
-	{"[section]\nname=\"value", &conf01{}, false},
-	// error: invalid escape
-	{"\n[section]\nname=\\", &conf01{}, false},
-	{"\n[section]\nname=\\a", &conf01{}, false},
-	{"\n[section]\nname=\"val\\a\"", &conf01{}, false},
-	{"\n[section]\nname=val\\", &conf01{}, false},
-	{"\n[sub \"A\\\n\"]\nname=value", &conf04{}, false},
-	{"\n[sub \"A\\\t\"]\nname=value", &conf04{}, false},
-	// error: invalid broken line
-	{"[section]\nname=\"value \\\n value\"", &conf01{}, false},
+	{"\n[sub \"A\"]\nname=value", &cSubs{map[string]*cSubsS1{"A": &cSubsS1{"value"}}}, true},
+	{"\n[sub \"b\"]\nname=value", &cSubs{map[string]*cSubsS1{"b": &cSubsS1{"value"}}}, true},
+	{"\n[sub \"A\\\\\"]\nname=value", &cSubs{map[string]*cSubsS1{"A\\": &cSubsS1{"value"}}}, true},
+	{"\n[sub \"A\\\"\"]\nname=value", &cSubs{map[string]*cSubsS1{"A\"": &cSubsS1{"value"}}}, true},
+}}, {"errors", []readtest{ // scanning/parsing errors (except value parsing)
+	// invalid line
+	{"\n[section]\n=", &cBasic{}, false},
+	// no section
+	{"name=value", &cBasic{}, false},
+	// failed to parse
+	{"\n[section]\nbool=maybe", &cBool{cBoolS1{}}, false},
+	// empty section
+	{"\n[]\nname=value", &cBasic{}, false},
+	// empty subsection
+	{"\n[sub \"\"]\nname=value", &cSubs{}, false},
+	// section name not matched
+	{"\n[nonexistent]\nname=value", &cBasic{}, false},
+	// subsection name not matched
+	{"\n[section \"nonexistent\"]\nname=value", &cBasic{}, false},
+	// variable name not matched
+	{"\n[section]\nnonexistent=value", &cBasic{}, false},
+	// missing end quote
+	{"[section]\nname=\"value", &cBasic{}, false},
+	// invalid escape
+	{"\n[section]\nname=\\", &cBasic{}, false},
+	{"\n[section]\nname=\\a", &cBasic{}, false},
+	{"\n[section]\nname=\"val\\a\"", &cBasic{}, false},
+	{"\n[section]\nname=val\\", &cBasic{}, false},
+	{"\n[sub \"A\\\n\"]\nname=value", &cSubs{}, false},
+	{"\n[sub \"A\\\t\"]\nname=value", &cSubs{}, false},
+	// invalid broken line
+	{"[section]\nname=\"value \\\n value\"", &cBasic{}, false},
+}}, {"bool", []readtest{
+	// explicit values
+	{"[section]\nbool=true", &cBool{cBoolS1{true}}, true},
+	{"[section]\nbool=yes", &cBool{cBoolS1{true}}, true},
+	{"[section]\nbool=on", &cBool{cBoolS1{true}}, true},
+	{"[section]\nbool=1", &cBool{cBoolS1{true}}, true},
+	{"[section]\nbool=false", &cBool{cBoolS1{false}}, true},
+	{"[section]\nbool=no", &cBool{cBoolS1{false}}, true},
+	{"[section]\nbool=off", &cBool{cBoolS1{false}}, true},
+	// default value (true)
+	{"[section]\nbool", &cBool{cBoolS1{true}}, true},
+	{"[section]\nbool=0", &cBool{cBoolS1{false}}, true},
+	// bool parse errors
+	{"[section]\nbool=t", &cBool{}, false},
+	{"[section]\nbool=truer", &cBool{}, false},
+	{"[section]\nbool=-1", &cBool{}, false},
 }},
 }