summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-04-11 18:01:01 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-04-11 18:01:01 +0200
commit53345e1f1fedf63f8d21b5c2959ae6bca3dabde1 (patch)
treebc6dd113269e312cb213549695ea899b729d6870
parent52ca4f8a3992a8ca1672abb6263455f01a03549b (diff)
downloadlibgit2-53345e1f1fedf63f8d21b5c2959ae6bca3dabde1.tar.gz
config: add tests for number suffix
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
-rw-r--r--tests/resources/config/config56
-rw-r--r--tests/t15-config.c24
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/resources/config/config5 b/tests/resources/config/config5
new file mode 100644
index 000000000..645fe7645
--- /dev/null
+++ b/tests/resources/config/config5
@@ -0,0 +1,6 @@
+# Test for number suffixes
+[number]
+ simple = 1
+ k = 1k
+ m = 1m
+ g = 1g
diff --git a/tests/t15-config.c b/tests/t15-config.c
index 2cbd05896..1cf4b418f 100644
--- a/tests/t15-config.c
+++ b/tests/t15-config.c
@@ -129,10 +129,34 @@ int i;
git_config_free(cfg);
END_TEST
+BEGIN_TEST(config5, "test number suffixes")
+ git_config *cfg;
+ const char *str;
+ long int i;
+
+ must_pass(git_config_open(&cfg, CONFIG_BASE "/config5"));
+
+ must_pass(git_config_get_long(cfg, "number.simple", &i));
+ must_be_true(i == 1);
+
+ must_pass(git_config_get_long(cfg, "number.k", &i));
+ must_be_true(i == 1 * 1024);
+
+ must_pass(git_config_get_long(cfg, "number.m", &i));
+ must_be_true(i == 1 * 1024 * 1024);
+
+ must_pass(git_config_get_long(cfg, "number.g", &i));
+ must_be_true(i == 1 * 1024 * 1024 * 1024);
+
+ git_config_free(cfg);
+END_TEST
+
+
BEGIN_SUITE(config)
ADD_TEST(config0);
ADD_TEST(config1);
ADD_TEST(config2);
ADD_TEST(config3);
ADD_TEST(config4);
+ ADD_TEST(config5);
END_SUITE