-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from raquentin/context-specific-lexing
feat: context-specific lexing
- Loading branch information
Showing
20 changed files
with
549 additions
and
12,516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
name: C++ CI | ||
name: CI Build and Test | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
build: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up CMake | ||
uses: lukka/[email protected] | ||
|
||
- name: Install dependencies | ||
run: sudo apt-get install -y libcurl4-openssl-dev | ||
|
||
- name: Install Google Test | ||
run: | | ||
sudo apt-get install -y libgtest-dev | ||
cd /usr/src/gtest | ||
sudo cmake . | ||
sudo make | ||
sudo cp *.a /usr/lib | ||
- name: Configure project | ||
run: cmake -S . -B build | ||
|
||
- name: Build project | ||
run: cmake --build build | ||
|
||
- name: Run Tests | ||
run: ctest --test-dir build | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Configure CMake | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. | ||
- name: Build the project | ||
run: | | ||
cd build | ||
cmake --build . | ||
- name: Run tests | ||
run: | | ||
cd build | ||
ctest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma once | ||
#include "regex.hpp" | ||
#include "response.hpp" | ||
#include <optional> | ||
#include <string> | ||
#include <vector> | ||
|
||
enum class FailedAssertionType { | ||
UnexpectedStatusCode, | ||
MissingHeader, | ||
UnexpectedHeader, | ||
MissingJsonField, | ||
UnexpectedJsonField, | ||
}; | ||
|
||
struct FailedAssertion { | ||
FailedAssertionType type; | ||
std::string message; | ||
}; | ||
|
||
class Assertions { | ||
public: | ||
static Assertions create(); | ||
|
||
Assertions &status_codes(const std::vector<int> &expected_codes); | ||
Assertions &header(const std::string &key, const std::string &expected_value); | ||
Assertions &json_field(const std::string &key, const std::string &pattern); | ||
|
||
std::optional<FailedAssertion> validate(const Response &response) const; | ||
|
||
private: | ||
std::vector<int> expected_status_codes; | ||
std::vector<std::pair<std::string, std::string>> expected_headers; | ||
std::vector<std::pair<std::string, Regex>> expected_json_fields; | ||
|
||
Assertions(); | ||
|
||
std::optional<FailedAssertion> | ||
validate_status_code(const Response &response) const; | ||
std::optional<FailedAssertion> | ||
validate_header(const Response &response) const; | ||
std::optional<FailedAssertion> | ||
validate_json_fields(const Response &response) const; | ||
}; |
Oops, something went wrong.