Mercurial > malikania
diff tests/libclient/js-rectangle/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-rectangle/main.cpp Sun Nov 27 20:50:38 2016 +0100 +++ b/tests/libclient/js-rectangle/main.cpp Tue Nov 29 21:21:36 2016 +0100 @@ -18,7 +18,7 @@ #include <gtest/gtest.h> -#include <malikania/js-rectangle.hpp> +#include <malikania/js_rectangle.hpp> using namespace malikania; @@ -51,8 +51,9 @@ "h = r.height;" ); - 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)); @@ -82,8 +83,9 @@ "h = r.height;" ); - 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)); @@ -113,8 +115,9 @@ "h = r.height;" ); - 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)); @@ -144,8 +147,9 @@ "h = r.height;" ); - 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)); @@ -181,8 +185,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)); @@ -207,8 +212,9 @@ "}" ); - if (ret != 0) + if (ret != 0) { throw dukx_exception(m_ctx, -1); + } duk_get_global_string(m_ctx, "name"); ASSERT_STREQ("RangeError", duk_to_string(m_ctx, -1)); @@ -230,7 +236,7 @@ { try { duk_push_c_function(m_ctx, [] (auto ctx) { - Rectangle rect = dukx_require_rect(ctx, 0); + auto rect = dukx_require_rect(ctx, 0); duk_push_int(ctx, rect.x()); duk_put_global_string(ctx, "x"); @@ -247,8 +253,9 @@ auto ret = duk_peval_string(m_ctx, "build({ x: 50, y: 80, width: 100, height: 200 });"); - if (ret != 0) + if (ret != 0) { throw dukx_exception(m_ctx, -1); + } duk_get_global_string(m_ctx, "x"); ASSERT_EQ(50, duk_to_int(m_ctx, -1)); @@ -286,8 +293,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)); @@ -309,7 +317,7 @@ { try { duk_push_c_function(m_ctx, [] (auto ctx) { - Rectangle rect = dukx_get_rect(ctx, 0); + auto rect = dukx_get_rect(ctx, 0); duk_push_int(ctx, rect.x()); duk_put_global_string(ctx, "x"); @@ -325,8 +333,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));