Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Configure Renovate - abandoned #1

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Full Test

on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install CMake
run: |
sudo apt-get -qq update
sudo apt-get install -y -qq pkg-config cmake

- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh 19

- name: Install Catch2
run: vcpkg install catch2

- name: Build and test
run: |
mkdir build && cd build
cmake .. -DBUILD_TESTING=ON
make
make test

# jobs:
# ubuntu:
# runs-on: ${{ matrix.compiler.os }}
# strategy:
# fail-fast: false
# matrix:
# compiler:
# - cc: clang
# cxx: clang++
# ver: 15
# os: ubuntu-22.04
# - cc: clang
# cxx: clang++
# ver: 16
# os: ubuntu-22.04
# - cc: clang
# cxx: clang++
# ver: 17
# os: ubuntu-24.04
# - cc: clang
# cxx: clang++
# ver: 18
# os: ubuntu-24.04
# - cc: clang
# cxx: clang++
# ver: 19
# os: ubuntu-24.04
# - cc: gcc
# cxx: g++
# ver: 11
# os: ubuntu-22.04
# - cc: gcc
# cxx: g++
# ver: 12
# os: ubuntu-24.04
# - cc: gcc
# cxx: g++
# ver: 13
# os: ubuntu-24.04
# - cc: gcc
# cxx: g++
# ver: 14
# os: ubuntu-24.04
# env:
# CC: ${{ matrix.compiler.cc }}-${{ matrix.compiler.ver }}
# CXX: ${{ matrix.compiler.cxx }}-${{ matrix.compiler.ver }}
# steps:
# - uses: actions/checkout@v4

# - name: Install CMake
# run: |
# sudo apt-get -qq update
# sudo apt-get install -y -qq pkg-config cmake

# - name: Install Clang
# if: startsWith(matrix.compiler.cxx, 'clang')
# run: |
# wget https://apt.llvm.org/llvm.sh
# chmod +x ./llvm.sh
# sudo ./llvm.sh ${{ matrix.compiler.ver }}

# - name: Install GCC
# if: matrix.compiler.cxx == 'g++' && matrix.compiler.ver == 14
# run: sudo apt update && sudo apt install -y gcc-14

# - name: Build and test
# run: |
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# mkdir build && cd build
# cmake .. -DBUILD_TESTING=ON
# make
# make test

# macos:
# runs-on: macos-${{ matrix.osver }}
# strategy:
# fail-fast: false
# matrix:
# osver: [13, 14, 15]
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true

# - name: Install CMake
# run: brew install pkg-config cmake

# - name: Build and test
# run: |
# mkdir build && cd build
# cmake .. -DBUILD_TESTING=ON
# make
# make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/cabin-out
cabin.lock
/build
/.vscode
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.30)
## Set our project name
project(unindent
VERSION 0.1.0
Expand Down
14 changes: 14 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[config]
skip_core_tasks = true
default_to_workspace = false

[env]
REPOSITORY_ROOT = { script = [ "git rev-parse --show-superproject-working-tree --show-toplevel" ] }

[tasks.test]
script_runner = "@shell"
script = [
"cd build",
"make",
"make test",
]
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# unindent
# Unindent

This is a small C++20 library that provides a simple way to unindent the raw string literals at compile time.
This is a small C++20 library that provides a simple way to make indent-adjusted multiline raw string literals at compile time.

## Example
## Synopsis

Unindent provides two new user-defined literals for indented strings: `"..."_i` and `"..."_i1`:

The `"..."_i` UDL removes the indent applied in the source file. The behaviour is similar to Coffeescript's [multiline string literals](https://coffeescript.org/#strings):

```cpp
#include <iostream>
#include <string_view>

#include <unindent/unindent.hpp>
Expand All @@ -20,7 +23,31 @@ int main() {
print("World")
)"_i;

static_assert(unindented_str == "def foo():\n print(\"Hello\")\n print(\"World\")"sv);
static_assert(unindented_str ==
"def foo():\n print(\"Hello\")\n\n print(\"World\")"sv);
}
```

The `"..."_i1` UDL is like `"..."_i`, except it folds "paragraphs" of text into single lines. The behaviour is similar to [YAML's folded multiline strings](https://yaml.org/spec/1.2-old/spec.html#id2796251):

```cpp
#include <string_view>

#include <unindent/unindent.hpp>

int main() {
using namespace std::literals;
using namespace mitama::unindent::literals;
constexpr std::string_view folded_str = R"(
This is the first line.
This line is appended to the first.

This line follows a line break.
This line ends up indented by two spaces.
)"_i1;

static_assert(
folded_str ==
"This is the first line. This line is appended to the first.\nThis line follows a line break. This line ends up indented by two spaces."sv);
}
```
Loading
Loading