Skip to content

Commit

Permalink
Fix example builds with incorrectly indented document markers (#473)
Browse files Browse the repository at this point in the history
* fixed examples with misindented document markers

* added a workflow job which checks example builds
  • Loading branch information
fktn-k authored Jan 25, 2025
1 parent d361611 commit 137b57d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 36 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ jobs:
- name: Run Clang Sanitizers
run: make clang-sanitizers

ci_examples:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Build examples
run: make examples

ci_test_clang_cxx_standards:
runs-on: ubuntu-latest
container: silkeh/clang:latest
Expand Down
24 changes: 12 additions & 12 deletions examples/apis/basic_node/deserialize_docs_char_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
int main() {
// deserialize a YAML string.
char input[] = R"(
%YAML 1.2
---
foo: true
bar: 123
baz: 3.14
...
%TAG ! tag:test.com,2000:
---
null: one
false: 456
TRUE: 1.414
)";
%YAML 1.2
---
foo: true
bar: 123
baz: 3.14
...
%TAG ! tag:test.com,2000:
---
null: one
false: 456
TRUE: 1.414
)";
std::vector<fkyaml::node> docs = fkyaml::node::deserialize_docs(input);

// check the deserialization result.
Expand Down
24 changes: 12 additions & 12 deletions examples/apis/basic_node/deserialize_docs_iterators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
int main() {
// deserialize a YAML string.
std::string input = R"(
%YAML 1.2
---
foo: true
bar: 123
baz: 3.14
...
%TAG ! tag:test.com,2000:
---
null: one
false: 456
TRUE: 1.414
)";
%YAML 1.2
---
foo: true
bar: 123
baz: 3.14
...
%TAG ! tag:test.com,2000:
---
null: one
false: 456
TRUE: 1.414
)";
std::vector<fkyaml::node> docs = fkyaml::node::deserialize_docs(std::begin(input), std::end(input));

// check the deserialization result.
Expand Down
24 changes: 12 additions & 12 deletions examples/apis/basic_node/deserialize_docs_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
int main() {
// deserialize a YAML string.
std::string s = R"(
%YAML 1.2
---
foo: true
bar: 123
baz: 3.14
...
%TAG ! tag:test.com,2000:
---
null: one
false: 456
TRUE: 1.414
)";
%YAML 1.2
---
foo: true
bar: 123
baz: 3.14
...
%TAG ! tag:test.com,2000:
---
null: one
false: 456
TRUE: 1.414
)";
std::vector<fkyaml::node> docs = fkyaml::node::deserialize_docs(s);

// check the deserialization result.
Expand Down

0 comments on commit 137b57d

Please sign in to comment.