From 1184678086b284944bb119a97ca048b64d4078b6 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Fri, 17 May 2019 21:43:50 +0200 Subject: 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. --- test/example/c-api-kitchen-sink.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/example/c-api-kitchen-sink.c') 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; } -- cgit v1.2.3