diff options
author | Siddharth <siddu.druid@gmail.com> | 2019-05-17 21:43:50 +0200 |
---|---|---|
committer | Alon Zakai <azakai@google.com> | 2019-05-17 12:43:49 -0700 |
commit | 1184678086b284944bb119a97ca048b64d4078b6 (patch) | |
tree | 1caedfbaa927e2cb03f46feeead9d48b5cdfb55b /test/example/c-api-kitchen-sink.c | |
parent | 1095ef96673f4f33d76da6d58b0ad65c3c257f76 (diff) | |
download | binaryen-1184678086b284944bb119a97ca048b64d4078b6.tar.gz binaryen-1184678086b284944bb119a97ca048b64d4078b6.tar.bz2 binaryen-1184678086b284944bb119a97ca048b64d4078b6.zip |
Allow color API to enable and disable colors (#2111)
This is useful for front-ends which wish to selectively enable or
disable coloring.
Also expose these APIs from the C API.
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 9e996a881..1761ab0bb 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -813,6 +813,21 @@ void test_tracing() { BinaryenSetAPITracing(0); } +void test_color_status() { + int i; + + // save old state + const int old_state = BinaryenAreColorsEnabled(); + + // Check that we can set the state to both {0, 1} + for(i = 0; i <= 1; i++){ + BinaryenSetColorsEnabled(i); + assert(BinaryenAreColorsEnabled() == i); + } + + BinaryenSetColorsEnabled(old_state); +} + int main() { test_types(); test_core(); @@ -822,6 +837,7 @@ int main() { test_interpret(); test_nonvalid(); test_tracing(); + test_color_status(); return 0; } |