From 6f8ecf4330010e80058a511b142dcadaf5797dda Mon Sep 17 00:00:00 2001 From: seleznevae Date: Wed, 9 May 2018 13:29:29 +0300 Subject: [PATCH] [A] Added xcode to the CI --- .travis.yml | 16 ++++++++++++++-- README.md | 38 +++++++++++++++----------------------- example/main.c | 2 -- tests/main_test.c | 8 ++++++++ 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a7037a..f954676 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,6 @@ matrix: compiler: clang env: CC=clang - - # Linux / GCC - os: linux sudo: false @@ -59,6 +57,20 @@ matrix: apt: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-7'] + + + # OSX / Clang + - os: osx + osx_image: xcode7.3 + env: CC=clang + + - os: osx + osx_image: xcode8.3 + env: CC=clang + + - os: osx + osx_image: xcode9.3 + env: CC=clang diff --git a/README.md b/README.md index 917f1b6..32ba3d7 100644 --- a/README.md +++ b/README.md @@ -58,35 +58,27 @@ Output: +---+---------+-------------+ ``` - ### Customize table appearance ```C -#include -#include "fort.h" -int main(void) -{ - ft_table_t *table = ft_create_table(); - ft_set_border_style(table, FT_DOUBLE2_STYLE); - /* Set center alignment for the 1st column */ - ft_set_cell_option(table, FT_ANY_ROW, 1, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER); - /* Set center alignment for the 3rd column */ - ft_set_cell_option(table, FT_ANY_ROW, 3, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER); +ft_table_t *table = ft_create_table(); +ft_set_border_style(table, FT_DOUBLE2_STYLE); +/* Set center alignment for the 1st column */ +ft_set_cell_option(table, FT_ANY_ROW, 1, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER); +/* Set center alignment for the 3rd column */ +ft_set_cell_option(table, FT_ANY_ROW, 3, FT_COPT_TEXT_ALIGN, FT_ALIGNED_CENTER); - /* Set "header" type for the first row */ - ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER); - ft_write_ln(table, "Movie title", "Director", "Year", "Rating"); +/* Set "header" type for the first row */ +ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER); +ft_write_ln(table, "Movie title", "Director", "Year", "Rating"); +ft_write_ln(table, "The Shawshank Redemption", "Frank Darabont", "1994", "9.5"); +ft_write_ln(table, "The Godfather", "Francis Ford Coppola", "1972", "9.2"); +ft_write_ln(table, "12 Angry Men", "Sidney Lumet", "1957", "8.8"); +ft_write_ln(table, "2001: A Space Odyssey", "Stanley Kubrick", "1968", "8.5"); - ft_write_ln(table, "The Shawshank Redemption", "Frank Darabont", "1994", "9.5"); - ft_write_ln(table, "The Godfather", "Francis Ford Coppola", "1972", "9.2"); - ft_write_ln(table, "12 Angry Men", "Sidney Lumet", "1957", "8.8"); - ft_write_ln(table, "2001: A Space Odyssey", "Stanley Kubrick", "1968", "8.5"); - - - printf("%s\n", ft_to_string(table)); - ft_destroy_table(table); -} +printf("%s\n", ft_to_string(table)); +ft_destroy_table(table); ``` Output: ```text diff --git a/example/main.c b/example/main.c index 9b94b90..810dc8d 100644 --- a/example/main.c +++ b/example/main.c @@ -61,13 +61,11 @@ void different_cell_options(void) ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER); ft_write_ln(table, "Movie title", "Director", "Year", "Rating"); - ft_write_ln(table, "The Shawshank Redemption", "Frank Darabont", "1994", "9.5"); ft_write_ln(table, "The Godfather", "Francis Ford Coppola", "1972", "9.2"); ft_write_ln(table, "12 Angry Men", "Sidney Lumet", "1957", "8.8"); ft_write_ln(table, "2001: A Space Odyssey", "Stanley Kubrick", "1968", "8.5"); - printf("%s\n", ft_to_string(table)); ft_destroy_table(table); } diff --git a/tests/main_test.c b/tests/main_test.c index 0686e13..458dd2e 100644 --- a/tests/main_test.c +++ b/tests/main_test.c @@ -61,6 +61,14 @@ int main(void) { int status = 0; + /* + * Essential for OSX, because swprintf can fail in case of real unicode + * chars. + */ +#if defined(FT_HAVE_WCHAR) + setlocale(LC_CTYPE, ""); +#endif + #ifdef FORT_WB_TESTING_ENABLED status |= run_wb_test_suit(); fprintf(stderr, "\n");