mirror of
https://github.com/allankoechke/jwt-cpp.git
synced 2026-11-30 10:18:40 +00:00
Bugfix, cppcheck fixes, picojson update
* Updated picojson to current master * Fixed a bug where wrong variable was used * Fixed some style issues detected by cppcheck * Added explicit modifier to jwt::claim. Enable them by defining JWT_CLAIM_EXPLICIT to 1. This is default off for compatibility, but will be default on at a later time.
This commit is contained in:
15
TokenFormatTest.cpp
Normal file
15
TokenFormatTest.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "include/jwt-cpp/jwt.h"
|
||||
|
||||
TEST(TokenFormatTest, MissingDot) {
|
||||
ASSERT_THROW(jwt::decode("eyJhbGciOiJub25lIiwidHlwIjoiSldTIn0.eyJpc3MiOiJhdXRoMCJ9"), std::invalid_argument);
|
||||
ASSERT_THROW(jwt::decode("eyJhbGciOiJub25lIiwidHlwIjoiSldTIn0eyJpc3MiOiJhdXRoMCJ9."), std::invalid_argument);
|
||||
}
|
||||
|
||||
TEST(TokenFormatTest, InvalidChar) {
|
||||
ASSERT_THROW(jwt::decode("eyJhbGciOiJub25lIiwidHlwIjoiSldTIn0().eyJpc3MiOiJhdXRoMCJ9."), std::runtime_error);
|
||||
}
|
||||
|
||||
TEST(TokenFormatTest, InvalidJSON) {
|
||||
ASSERT_THROW(jwt::decode("YXsiYWxnIjoibm9uZSIsInR5cCI6IkpXUyJ9YQ.eyJpc3MiOiJhdXRoMCJ9."), std::runtime_error);
|
||||
}
|
||||
Reference in New Issue
Block a user