]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Test case was added for Korean Meridiem Parser support.
authorJeeeyul <Jeeeyul@gmail.com>
Thu, 19 Dec 2013 06:36:51 +0000 (15:36 +0900)
committerJeeeyul <Jeeeyul@gmail.com>
Thu, 19 Dec 2013 06:36:51 +0000 (15:36 +0900)
test/lang/ko.js

index 947183fd7ee0024f51f4ecb7d89c7112cfbe066e..40e50a76bedaae3db5e0a30e2aea445b63733359 100644 (file)
@@ -36,6 +36,46 @@ exports["lang:kr"] = {
         }
         test.done();
     },
+    
+    
+    "parse meridiem" : function(test){
+       var elements = [{
+               expression : "1981년 9월 8일 오후 2시 30분",
+               inputFormat : "YYYY[년] M[월] D[일] A h[시] m[분]",
+               outputFormat : "A",
+               expected : "오후"
+       },{
+               expression : "1981년 9월 8일 오전 2시 30분",
+               inputFormat : "YYYY[년] M[월] D[일] A h[시] m[분]",
+               outputFormat : "A h시",
+               expected : "오전 2시"
+       },{
+               expression : "14시 30분",
+               inputFormat : "H[시] m[분]",
+               outputFormat : "A",
+               expected : "오후"
+       },{
+               expression : "오후 4시",
+               inputFormat : "A h[시]",
+               outputFormat : "H",
+               expected : "16"
+       }];
+  
+       test.expect(elements.length);
+       
+               elements.forEach(function(it){
+                       var actual = moment(it.expression, it.inputFormat).format(it.outputFormat);
+                       
+                       test.equal(
+                               actual,
+                               it.expected, 
+                               "'" + it.outputFormat + "' of '" + it.expression + "' must be '" + it.expected + "' but was '" + actual + "'."
+                       );
+               });
+       
+       test.done();
+    },
+    
     "format" : function (test) {
         test.expect(22);