diff tests/libclient/js-point/main.cpp @ 42:a47a4477f347

Misc: new style, closes #578
author David Demelier <markand@malikania.fr>
date Tue, 29 Nov 2016 21:21:36 +0100
parents 9af360f34c7d
children fabbe1759cec
line wrap: on
line diff
--- a/tests/libclient/js-point/main.cpp	Sun Nov 27 20:50:38 2016 +0100
+++ b/tests/libclient/js-point/main.cpp	Tue Nov 29 21:21:36 2016 +0100
@@ -18,7 +18,7 @@
 
 #include <gtest/gtest.h>
 
-#include <malikania/js-point.hpp>
+#include <malikania/js_point.hpp>
 
 using namespace malikania;
 
@@ -49,8 +49,9 @@
             "y = p.y;"
         );
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         duk_get_global_string(m_ctx, "x");
         ASSERT_EQ(0, duk_to_int(m_ctx, -1));
@@ -72,8 +73,9 @@
             "y = p.y;"
         );
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         duk_get_global_string(m_ctx, "x");
         ASSERT_EQ(-10, duk_to_int(m_ctx, -1));
@@ -95,8 +97,9 @@
             "y = p.y;"
         );
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         duk_get_global_string(m_ctx, "x");
         ASSERT_EQ(100, duk_to_int(m_ctx, -1));
@@ -118,8 +121,9 @@
             "y = p.y;"
         );
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         duk_get_global_string(m_ctx, "x");
         ASSERT_EQ(100, duk_to_int(m_ctx, -1));
@@ -149,8 +153,9 @@
             "}"
         );
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         duk_get_global_string(m_ctx, "name");
         ASSERT_STREQ("TypeError", duk_to_string(m_ctx, -1));
@@ -172,7 +177,7 @@
 {
     try {
         duk_push_c_function(m_ctx, [] (auto ctx) {
-            Point point = dukx_require_point(ctx, 0);
+            auto point = dukx_require_point(ctx, 0);
 
             duk_push_int(ctx, point.x());
             duk_put_global_string(ctx, "x");
@@ -185,8 +190,9 @@
 
         auto ret = duk_peval_string(m_ctx, "build({ x: 100, y: 200 });");
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         duk_get_global_string(m_ctx, "x");
         ASSERT_EQ(100, duk_to_int(m_ctx, -1));
@@ -218,8 +224,9 @@
             "}"
         );
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         duk_get_global_string(m_ctx, "name");
         ASSERT_STREQ("Error", duk_to_string(m_ctx, -1));
@@ -241,7 +248,7 @@
 {
     try {
         duk_push_c_function(m_ctx, [] (auto ctx) {
-            Point point = dukx_get_point(ctx, 0);
+            auto point = dukx_get_point(ctx, 0);
 
             duk_push_int(ctx, point.x());
             duk_put_global_string(ctx, "x");
@@ -254,8 +261,9 @@
 
         auto ret = duk_peval_string(m_ctx, "build({});");
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         duk_get_global_string(m_ctx, "x");
         ASSERT_EQ(0, duk_to_int(m_ctx, -1));