summaryrefslogtreecommitdiff
path: root/src/ast/item_test.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-11-03 13:35:54 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-11-04 20:10:50 -0800
commit1853e964e96c41e762ca0ab97259ee4e79d86ec7 (patch)
treeedc76f58ed786263a28da79564786f4d75400092 /src/ast/item_test.cpp
parent1a00fe4ea75924bfe594c4d92073cc95eaa2f32d (diff)
downloadtmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.gz
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.bz2
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.tar.xz
tmwa-1853e964e96c41e762ca0ab97259ee4e79d86ec7.zip
Use the new ASTs
Diffstat (limited to 'src/ast/item_test.cpp')
-rw-r--r--src/ast/item_test.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ast/item_test.cpp b/src/ast/item_test.cpp
index 3b5fd07..a77662e 100644
--- a/src/ast/item_test.cpp
+++ b/src/ast/item_test.cpp
@@ -24,7 +24,7 @@
#include "../tests/fdhack.hpp"
-//#include "../poison.hpp"
+#include "../poison.hpp"
namespace tmwa
@@ -54,7 +54,7 @@ namespace item
{
io::LineCharReader lr(io::from_string, "<string>"_s, input);
auto res = parse_item(lr);
- EXPECT_EQ(res.get_success(), Some(std::unique_ptr<ItemOrComment>(nullptr)));
+ EXPECT_TRUE(res.is_none());
}
}
TEST(itemast, comment)
@@ -70,11 +70,11 @@ namespace item
for (auto input : inputs)
{
io::LineCharReader lr(io::from_string, "<string>"_s, input);
- auto res = parse_item(lr);
+ auto res = TRY_UNWRAP(parse_item(lr), FAIL());
EXPECT_TRUE(res.get_success().is_some());
auto top = TRY_UNWRAP(std::move(res.get_success()), FAIL());
- EXPECT_SPAN(top->span, 1,1, 1,8);
- auto p = dynamic_cast<Comment *>(top.get());
+ EXPECT_SPAN(top.span, 1,1, 1,8);
+ auto p = top.get_if<Comment>();
EXPECT_TRUE(p);
if (p)
{
@@ -96,11 +96,11 @@ namespace item
for (auto input : inputs)
{
io::LineCharReader lr(io::from_string, "<string>"_s, input);
- auto res = parse_item(lr);
+ auto res = TRY_UNWRAP(parse_item(lr), FAIL());
EXPECT_TRUE(res.get_success().is_some());
auto top = TRY_UNWRAP(std::move(res.get_success()), FAIL());
- EXPECT_SPAN(top->span, 1,1, 1,58);
- auto p = dynamic_cast<Item *>(top.get());
+ EXPECT_SPAN(top.span, 1,1, 1,58);
+ auto p = top.get_if<Item>();
EXPECT_TRUE(p);
if (p)
{