Skip to content

Commit

Permalink
Update tests to adapt to new ruby null return.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Oct 28, 2020
1 parent 3fb57a8 commit d5bd1ca
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ TEST_F(metacall_distributable_test, DefaultConstructor)

metacall_value_destroy(ret);

EXPECT_EQ((void *) NULL, (void *) metacall("say_null"));
ret = metacall("say_null");

EXPECT_NE((void *) NULL, (void *) ret);

EXPECT_EQ((enum metacall_value_id) METACALL_NULL, (enum metacall_value_id) metacall_value_id(ret));

metacall_value_destroy(ret);

ret = metacall("say_hello", "meta-programmer");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,13 @@ TEST_F(metacall_ducktype_test, DefaultConstructor)
METACALL_INVALID
};

EXPECT_EQ((void *) NULL, (void *) metacallt("say_null", say_null_invalid_ids));
ret = metacallt("say_null", say_null_invalid_ids);

EXPECT_NE((void *) NULL, (void *) ret);

EXPECT_EQ((enum metacall_value_id) METACALL_NULL, (enum metacall_value_id) metacall_value_id(ret));

metacall_value_destroy(ret);

const enum metacall_value_id say_hello_str_ids[] =
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ TEST_F(metacall_load_configuration_test, DefaultConstructor)

metacall_value_destroy(ret);

EXPECT_EQ((void *) NULL, (void *) metacall("say_null"));
ret = metacall("say_null");

EXPECT_NE((void *) NULL, (void *) ret);

EXPECT_EQ((enum metacall_value_id) METACALL_NULL, (enum metacall_value_id) metacall_value_id(ret));

metacall_value_destroy(ret);

ret = metacall("say_hello", "meta-programmer");

Expand Down
8 changes: 7 additions & 1 deletion source/tests/metacall_test/source/metacall_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@ TEST_F(metacall_test, DefaultConstructor)

metacall_value_destroy(ret);

EXPECT_EQ((void *) NULL, (void *) metacall("say_null"));
ret = metacall("say_null");

EXPECT_NE((void *) NULL, (void *) ret);

EXPECT_EQ((enum metacall_value_id) METACALL_NULL, (enum metacall_value_id) metacall_value_id(ret));

metacall_value_destroy(ret);

ret = metacall("say_hello", "meta-programmer");

Expand Down
8 changes: 7 additions & 1 deletion source/tests/metacall_test/source/metacall_test_split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ class metacall_loader_test : public testing::Test

value_destroy(ret);

EXPECT_EQ((void *) NULL, (void *) metacall("say_null"));
ret = metacall("say_null");

EXPECT_NE((void *) NULL, (void *) ret);

EXPECT_EQ((enum metacall_value_id) METACALL_NULL, (enum metacall_value_id) metacall_value_id(ret));

metacall_value_destroy(ret);

ret = metacall("say_hello", "meta-programmer");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ TEST_F(py_loader_port_test, DefaultConstructor)

metacall_value_destroy(ret);

EXPECT_EQ((void *) NULL, (void *) metacall("say_null"));
ret = metacall("say_null");

EXPECT_NE((void *) NULL, (void *) ret);

EXPECT_EQ((enum metacall_value_id) METACALL_NULL, (enum metacall_value_id) metacall_value_id(ret));

metacall_value_destroy(ret);

ret = metacall("say_hello", "meta-programmer");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,21 @@ TEST_F(rb_loader_parser_integration_test, DefaultConstructor)

EXPECT_EQ((int) 0, (int) metacall_load_from_file("rb", rb_scripts, sizeof(rb_scripts) / sizeof(rb_scripts[0]), NULL));

EXPECT_EQ((void *) NULL, (void *) metacall("cache_initialize"));
ret = metacall("cache_initialize");

EXPECT_EQ((void *) NULL, (void *) metacall("cache_set", "meta", "call"));
EXPECT_NE((void *) NULL, (void *) ret);

EXPECT_EQ((enum metacall_value_id) METACALL_NULL, (enum metacall_value_id) metacall_value_id(ret));

metacall_value_destroy(ret);

ret = metacall("cache_set", "meta", "call");

EXPECT_NE((void *) NULL, (void *) ret);

EXPECT_EQ((enum metacall_value_id) METACALL_NULL, (enum metacall_value_id) metacall_value_id(ret));

metacall_value_destroy(ret);

ret = metacall("cache_has_key","meta");

Expand Down

0 comments on commit d5bd1ca

Please sign in to comment.