aboutsummaryrefslogtreecommitdiff
path: root/lib/ini/testdata
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-12 02:16:45 +0700
committerShulhan <ms@kilabit.info>2023-11-12 02:17:03 +0700
commitea11891722666b91b56ee18958a10a03290da88d (patch)
tree14aa314a1a97ea792a7c57a14b234777a799c62c /lib/ini/testdata
parent8e09dc17109f45a1daba2647c13e4dd3dcf93401 (diff)
downloadpakakeh.go-ea11891722666b91b56ee18958a10a03290da88d.tar.xz
lib/ini: append variable into section before any empty lines
Previously, appending a new variable into section always create an empty line before after the variable. For example, given the following section, [a] k = v [c] append "k2=v2" to section "a" will result [a] k = v k2=v [c] This changes fix this by appending variable only after non-empty lines, which result to [a] k = v k2= v [c] While at it, add empty space before variable value.
Diffstat (limited to 'lib/ini/testdata')
-rw-r--r--lib/ini/testdata/set.ini5
-rw-r--r--lib/ini/testdata/set_test.data37
2 files changed, 42 insertions, 0 deletions
diff --git a/lib/ini/testdata/set.ini b/lib/ini/testdata/set.ini
new file mode 100644
index 00000000..5882f109
--- /dev/null
+++ b/lib/ini/testdata/set.ini
@@ -0,0 +1,5 @@
+[host]
+ip_internal = 127.0.0.1
+
+[host "ms"]
+ip_internal = 127.1.0.1
diff --git a/lib/ini/testdata/set_test.data b/lib/ini/testdata/set_test.data
new file mode 100644
index 00000000..30b7fadd
--- /dev/null
+++ b/lib/ini/testdata/set_test.data
@@ -0,0 +1,37 @@
+Test data for Ini Set method.
+
+<<< case#1
+[host]
+ip_internal = 127.0.0.2
+
+[host "ms"]
+ip_internal = 127.1.0.1
+
+
+<<< case#2
+[host]
+ip_internal = 127.0.0.2
+ip_external = 192.168.100.205
+
+[host "ms"]
+ip_internal = 127.1.0.1
+
+
+<<< case#3
+[host]
+ip_internal = 127.0.0.2
+ip_external = 192.168.100.205
+
+[host "ms"]
+ip_internal = 127.1.0.2
+
+
+<<< case#4
+[host]
+ip_internal = 127.0.0.2
+ip_external = 192.168.100.205
+
+[host "ms"]
+ip_internal = 127.1.0.2
+ip_external = 192.168.56.10
+