瀏覽代碼

Added a test that adds a 'false' to an array

Benoit Blanchon 11 年之前
父節點
當前提交
77a3e1737d
共有 2 個文件被更改,包括 8 次插入1 次删除
  1. 1 1
      JsonGeneratorTests/JsonArray.h
  2. 7 0
      JsonGeneratorTests/JsonArrayTests.cpp

+ 1 - 1
JsonGeneratorTests/JsonArray.h

@@ -87,7 +87,7 @@ public:
                 break;
 
             case JSON_BOOLEAN:
-                append(buffer, bufferSize, "true");
+                append(buffer, bufferSize, items[i].value.boolean ? "true" : "false");
                 break;
             }
         }

+ 7 - 0
JsonGeneratorTests/JsonArrayTests.cpp

@@ -71,6 +71,13 @@ namespace JsonGeneratorTests
             AssertJsonIs("[true]");
         }
 
+        TEST_METHOD(AddFalse)
+        {
+            arr.add(false);
+
+            AssertJsonIs("[false]");
+        }
+
         void AssertJsonIs(const char* expected)
         {      
             char buffer[256];