2019-10-25 23:46:10 +02:00
/*
* IXSentryClientTest . cpp
* Author : Benjamin Sergeant
* Copyright ( c ) 2019 Machine Zone . All rights reserved .
2019-10-26 19:54:47 +02:00
*
* ( cd . . ; make ) & & . . / build / test / ixwebsocket_unittest sentry
2019-10-25 23:46:10 +02:00
*/
# include "catch.hpp"
# include <iostream>
# include <string.h>
2019-10-26 19:54:47 +02:00
# include <ixsentry/IXSentryClient.h>
2019-10-25 23:46:10 +02:00
using namespace ix ;
namespace ix
{
TEST_CASE ( " sentry " , " [sentry] " )
{
2019-10-26 19:54:47 +02:00
SECTION ( " Attempt to index nil " )
{
SentryClient sentryClient ( " " ) ;
std : : string stack = " Attempt to index nil[overlay]! \n stack traceback: \n \t foo.lua:2661: in function 'getFoo' \n \t foo.lua:1666: in function 'onUpdate' \n \t foo.lua:1751: in function <foo.lua:1728> " ;
auto frames = sentryClient . parseLuaStackTrace ( stack ) ;
REQUIRE ( frames . size ( ) = = 3 ) ;
}
2019-10-25 23:46:10 +02:00
SECTION ( " Attempt to perform nil " )
{
2019-10-26 19:54:47 +02:00
SentryClient sentryClient ( " " ) ;
std : : string stack = " Attempt to perform nil - 1572111278.299 \n stack traceback: \n \t foo.lua:57: in function <foo.lua:53> " ;
2019-10-25 23:46:10 +02:00
auto frames = sentryClient . parseLuaStackTrace ( stack ) ;
2019-10-26 19:54:47 +02:00
REQUIRE ( frames . size ( ) = = 1 ) ;
2019-10-25 23:46:10 +02:00
}
}
} // namespace ix