mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 11:55:51 +00:00 
			
		
		
		
	Add assertion to process method (#1453)
Also adjust clangd so it doesn't bother us with header files about `expected`.
This commit is contained in:
		
							
								
								
									
										4
									
								
								.clangd
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								.clangd
									
									
									
									
									
								
							@@ -5,4 +5,6 @@ Diagnostics:
 | 
			
		||||
  UnusedIncludes: Strict
 | 
			
		||||
  MissingIncludes: Strict
 | 
			
		||||
  Includes:
 | 
			
		||||
    IgnoreHeader: ".*/(detail|impl)/.*"
 | 
			
		||||
    IgnoreHeader:
 | 
			
		||||
      - ".*/(detail|impl)/.*"
 | 
			
		||||
      - ".*expected.*"
 | 
			
		||||
 
 | 
			
		||||
@@ -25,6 +25,7 @@
 | 
			
		||||
#include "rpc/common/Specs.hpp"
 | 
			
		||||
#include "rpc/common/Types.hpp"
 | 
			
		||||
#include "rpc/common/Validators.hpp"
 | 
			
		||||
#include "util/Assert.hpp"
 | 
			
		||||
 | 
			
		||||
#include <boost/json/conversion.hpp>
 | 
			
		||||
#include <boost/json/value.hpp>
 | 
			
		||||
@@ -40,6 +41,7 @@ FeatureHandler::process([[maybe_unused]] FeatureHandler::Input input, [[maybe_un
 | 
			
		||||
{
 | 
			
		||||
    // For now this handler only fires when "vetoed" is set in the request.
 | 
			
		||||
    // This always leads to a `notSupported` error as we don't want anyone to be able to
 | 
			
		||||
    ASSERT(false, "FeatureHandler::process is not implemented.");
 | 
			
		||||
    return Output{};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,7 @@
 | 
			
		||||
#include "rpc/handlers/Feature.hpp"
 | 
			
		||||
#include "util/Fixtures.hpp"
 | 
			
		||||
 | 
			
		||||
#include <boost/asio/io_context.hpp>
 | 
			
		||||
#include <boost/json/parse.hpp>
 | 
			
		||||
#include <gtest/gtest.h>
 | 
			
		||||
 | 
			
		||||
@@ -46,3 +47,13 @@ TEST_F(RPCFeatureHandlerTest, AlwaysNoPermissionForVetoed)
 | 
			
		||||
        );
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(RPCFeatureHandlerDeathTest, ProcessCausesDeath)
 | 
			
		||||
{
 | 
			
		||||
    FeatureHandler handler{};
 | 
			
		||||
    boost::asio::io_context ioContext;
 | 
			
		||||
    boost::asio::spawn(ioContext, [&](auto yield) {
 | 
			
		||||
        EXPECT_DEATH(handler.process(FeatureHandler::Input{"foo"}, Context{yield}), "");
 | 
			
		||||
    });
 | 
			
		||||
    ioContext.run();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user