From e186cf258bab7f6e14ca739a7248edab0c3b3047 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Mon, 14 Nov 2022 13:10:36 +1100 Subject: [PATCH] c-api: remove --- c-api/Cargo.lock | 777 ----------------- c-api/Cargo.toml | 20 - c-api/include/comrak_ffi.h | 70 -- c-api/src/comrak_ffi.rs | 46 - c-api/src/comrak_options.rs | 92 -- c-api/src/lib.rs | 59 -- c-api/src/string.rs | 36 - c-api/tests/Cargo.lock | 794 ------------------ c-api/tests/Cargo.toml | 18 - c-api/tests/build.rs | 76 -- c-api/tests/src/deps/picotest/picotest.c | 105 --- c-api/tests/src/deps/picotest/picotest.h | 41 - c-api/tests/src/main.rs | 9 - c-api/tests/src/test.c | 18 - c-api/tests/src/test.h | 12 - c-api/tests/src/test_comrak_basic.c | 24 - .../tests/src/test_comrak_extension_options.c | 222 ----- c-api/tests/src/test_comrak_parse_options.c | 47 -- c-api/tests/src/test_comrak_render_options.c | 119 --- c-api/tests/src/test_util.h | 15 - script/cibuild | 2 - 21 files changed, 2602 deletions(-) delete mode 100644 c-api/Cargo.lock delete mode 100644 c-api/Cargo.toml delete mode 100644 c-api/include/comrak_ffi.h delete mode 100644 c-api/src/comrak_ffi.rs delete mode 100644 c-api/src/comrak_options.rs delete mode 100644 c-api/src/lib.rs delete mode 100644 c-api/src/string.rs delete mode 100644 c-api/tests/Cargo.lock delete mode 100644 c-api/tests/Cargo.toml delete mode 100644 c-api/tests/build.rs delete mode 100644 c-api/tests/src/deps/picotest/picotest.c delete mode 100644 c-api/tests/src/deps/picotest/picotest.h delete mode 100644 c-api/tests/src/main.rs delete mode 100644 c-api/tests/src/test.c delete mode 100644 c-api/tests/src/test.h delete mode 100644 c-api/tests/src/test_comrak_basic.c delete mode 100644 c-api/tests/src/test_comrak_extension_options.c delete mode 100644 c-api/tests/src/test_comrak_parse_options.c delete mode 100644 c-api/tests/src/test_comrak_render_options.c delete mode 100644 c-api/tests/src/test_util.h diff --git a/c-api/Cargo.lock b/c-api/Cargo.lock deleted file mode 100644 index 319b9495..00000000 --- a/c-api/Cargo.lock +++ /dev/null @@ -1,777 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bit-set" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "comrak" -version = "0.14.0" -dependencies = [ - "clap", - "entities", - "memchr", - "once_cell", - "pest", - "pest_derive", - "regex", - "shell-words", - "syntect", - "typed-arena", - "unicode_categories", - "xdg", -] - -[[package]] -name = "comrak_ffi" -version = "0.1.0" -dependencies = [ - "cc", - "comrak", - "libc", - "paste", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "entities" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fancy-regex" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" -dependencies = [ - "bit-set", - "regex", -] - -[[package]] -name = "flate2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "getrandom" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "indexmap" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "line-wrap" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" -dependencies = [ - "safemem", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "miniz_oxide" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" -dependencies = [ - "adler", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - -[[package]] -name = "once_cell" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" - -[[package]] -name = "onig" -version = "6.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225" -dependencies = [ - "bitflags", - "lazy_static", - "libc", - "onig_sys", -] - -[[package]] -name = "onig_sys" -version = "69.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e" -dependencies = [ - "cc", - "pkg-config", -] - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "paste" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" -dependencies = [ - "maplit", - "pest", - "sha-1", -] - -[[package]] -name = "pkg-config" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" - -[[package]] -name = "plist" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" -dependencies = [ - "base64", - "indexmap", - "line-wrap", - "serde", - "time", - "xml-rs", -] - -[[package]] -name = "proc-macro2" -version = "1.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "serde" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" - -[[package]] -name = "serde_derive" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer", - "digest", - "fake-simd", - "opaque-debug", -] - -[[package]] -name = "shell-words" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "syn" -version = "1.0.96" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syntect" -version = "4.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031" -dependencies = [ - "bincode", - "bitflags", - "fancy-regex", - "flate2", - "fnv", - "lazy_static", - "lazycell", - "onig", - "plist", - "regex-syntax", - "serde", - "serde_derive", - "serde_json", - "walkdir", - "yaml-rust", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" -dependencies = [ - "itoa", - "libc", - "num_threads", -] - -[[package]] -name = "typed-arena" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "unicode-ident" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "unicode_categories" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "xdg" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" -dependencies = [ - "dirs", -] - -[[package]] -name = "xml-rs" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] diff --git a/c-api/Cargo.toml b/c-api/Cargo.toml deleted file mode 100644 index 5c121719..00000000 --- a/c-api/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "comrak_ffi" -version = "0.1.0" -description = "FFI bindings for the comrak crate" -edition = "2018" - -[dependencies] -comrak = { path = "../" } -libc = "0" -paste = "1.0" - -[build-dependencies] -cc = "1.0.46" - -[profile.release] -panic = "abort" -lto = true - -[lib] -crate-type = ["staticlib", "dylib"] diff --git a/c-api/include/comrak_ffi.h b/c-api/include/comrak_ffi.h deleted file mode 100644 index dd079a09..00000000 --- a/c-api/include/comrak_ffi.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef COMRAK_FFI_H -#define COMRAK_FFI_H - -#if defined(__cplusplus) -extern "C" { -#endif - -#include -#include - -typedef struct comrak_ComrakOptions comrak_options_t; - -// Creates new ComrakOptions struct. -comrak_options_t *comrak_options_new(); - -// Frees the memory allocated for ComrakOptions struct. -void comrak_options_free(comrak_options_t *options); - -void comrak_set_extension_option_strikethrough(comrak_options_t *options, bool value); -void comrak_set_extension_option_tagfilter(comrak_options_t *options, bool value); -void comrak_set_extension_option_table(comrak_options_t *options, bool value); -void comrak_set_extension_option_autolink(comrak_options_t *options, bool value); -void comrak_set_extension_option_tasklist(comrak_options_t *options, bool value); -void comrak_set_extension_option_superscript(comrak_options_t *options, bool value); -void comrak_set_extension_option_header_ids(comrak_options_t *options, const char *header_id, size_t header_id_len); -void comrak_set_extension_option_footnotes(comrak_options_t *options, bool value); -void comrak_set_extension_option_description_lists(comrak_options_t *options, bool value); -void comrak_set_extension_option_front_matter_delimiter(comrak_options_t *options, const char *front_matter_delimiter, size_t front_matter_delimiter_len); - -void comrak_set_parse_option_smart(comrak_options_t *options, bool value); -void comrak_set_parse_option_default_info_string(comrak_options_t *options, const char *default_info_string, size_t default_info_string_len); - -void comrak_set_render_option_hardbreaks(comrak_options_t *options, bool value); -void comrak_set_render_option_github_pre_lang(comrak_options_t *options, bool value); -void comrak_set_render_option_width(comrak_options_t *options, size_t value); -void comrak_set_render_option_unsafe_(comrak_options_t *options, bool value); -void comrak_set_render_option_escape(comrak_options_t *options, bool value); - - -// Library-allocated UTF-8 string fat pointer. -// -// The string is not NULL-terminated. -// -// Use `comrak_str_free` function to deallocate. -typedef struct { - // String data pointer. - const char *data; - - // The length of the string in bytes. - size_t len; -} comrak_str_t; - -// Convert 'text' (assumed to be a UTF-8 encoded string) from Commonmark to HTML, -// returning a null-terminated, UTF-8-encoded string, using the options specified. -comrak_str_t comrak_commonmark_to_html(const char *text, comrak_options_t *options); -// -// Convert 'text' (assumed to be a UTF-8 encoded string) from Commonmark back to CommonMark, -// returning a null-terminated, UTF-8-encoded string, using the options specified. -comrak_str_t comrak_commonmark_to_commonmark(const char *text, comrak_options_t *options); - -// Frees the memory held by the library-allocated string. -// -// This is valid to call even if `str.data == NULL` (it does nothing, like `free(NULL)`). -void comrak_str_free(comrak_str_t str); - -#if defined(__cplusplus) -} // extern C -#endif - -#endif // COMRAK_FFI_H diff --git a/c-api/src/comrak_ffi.rs b/c-api/src/comrak_ffi.rs deleted file mode 100644 index 188ec2cc..00000000 --- a/c-api/src/comrak_ffi.rs +++ /dev/null @@ -1,46 +0,0 @@ -use super::*; - -use libc::c_char; - -use comrak::ComrakOptions; -use std::ffi::CStr; - -/// Render Commonmark to HTML, with the given options. -#[no_mangle] -pub extern "C" fn comrak_commonmark_to_html( - c_md: *mut c_char, - c_comrak_options: *mut ComrakOptions, -) -> Str { - // Convert C string to Rust string - let md = unsafe { - assert!(!c_md.is_null()); - CStr::from_ptr(c_md).to_str().unwrap() - }; - - let comrak_options = to_ref_mut!(c_comrak_options); - - let result = comrak::markdown_to_html(md, &comrak_options); - - // return as fat pointer string - Str::new(result) -} - -/// Render Commonmark back to Commonmark, with the given options. -#[no_mangle] -pub extern "C" fn comrak_commonmark_to_commonmark( - c_md: *mut c_char, - c_comrak_options: *mut ComrakOptions, -) -> Str { - // Convert C string to Rust string - let md = unsafe { - assert!(!c_md.is_null()); - CStr::from_ptr(c_md).to_str().unwrap() - }; - - let comrak_options = to_ref_mut!(c_comrak_options); - - let result = comrak::markdown_to_commonmark(md, &comrak_options); - - // return as fat pointer string - Str::new(result) -} diff --git a/c-api/src/comrak_options.rs b/c-api/src/comrak_options.rs deleted file mode 100644 index be981cb2..00000000 --- a/c-api/src/comrak_options.rs +++ /dev/null @@ -1,92 +0,0 @@ -use super::*; -use libc::{c_char, size_t}; - -use comrak::ComrakOptions; - -use paste::paste; - -macro_rules! make_bool_option_func { - ($opt_type:ident, $name:ident) => { - paste! { - #[no_mangle] - pub extern "C" fn []( - c_comrak_options: *mut ComrakOptions, - value: bool, - ) { - let comrak_options = to_ref_mut!(c_comrak_options); - - comrak_options.$opt_type.$name = value; - } - } - }; -} - -macro_rules! make_c_char_option_func { - ($opt_type:ident, $name:ident) => { - paste! { - #[no_mangle] - pub extern "C" fn []( - c_comrak_options: *mut ComrakOptions, - v: *const c_char, - v_len: size_t, - ) { - let comrak_options = to_ref_mut!(c_comrak_options); - - if v.is_null() { - comrak_options.$opt_type.$name = None; - } else { - let value = unwrap_or_ret_err_code! { to_str!(v, v_len) }; - - comrak_options.$opt_type.$name = Some(value.to_string()); - } - } - } - }; -} - -macro_rules! make_size_t_option_func { - ($opt_type:ident, $name:ident) => { - paste! { - #[no_mangle] - pub extern "C" fn []( - c_comrak_options: *mut ComrakOptions, - value: size_t, - ) { - let comrak_options = to_ref_mut!(c_comrak_options); - - comrak_options.$opt_type.$name = value; - } - } - }; -} - -#[no_mangle] -pub extern "C" fn comrak_options_new() -> *mut ComrakOptions { - to_ptr_mut(ComrakOptions::default()) -} - -#[no_mangle] -pub extern "C" fn comrak_options_free(options: *mut ComrakOptions) { - assert!(!options.is_null()); - drop(unsafe { Box::from_raw(options) }); -} - -make_bool_option_func!(extension, strikethrough); -make_bool_option_func!(extension, tagfilter); -make_bool_option_func!(extension, table); -make_bool_option_func!(extension, autolink); -make_bool_option_func!(extension, tasklist); -make_bool_option_func!(extension, superscript); -make_c_char_option_func!(extension, header_ids); -make_bool_option_func!(extension, footnotes); -make_bool_option_func!(extension, description_lists); -make_c_char_option_func!(extension, front_matter_delimiter); - -make_bool_option_func!(parse, smart); -make_c_char_option_func!(parse, default_info_string); - -make_bool_option_func!(render, hardbreaks); -make_bool_option_func!(render, github_pre_lang); -make_size_t_option_func!(render, width); -make_bool_option_func!(render, unsafe_); -make_bool_option_func!(render, escape); diff --git a/c-api/src/lib.rs b/c-api/src/lib.rs deleted file mode 100644 index f4b02864..00000000 --- a/c-api/src/lib.rs +++ /dev/null @@ -1,59 +0,0 @@ -//! This crate provides a C ABI interface for the [comrak](https://crates.io/crate/comrak) crate. - -use std::{ptr, slice, str}; - -// aborts the thread if we receive NULL where unexpected -macro_rules! assert_not_null { - ($var:ident) => { - assert!(!$var.is_null(), "{} is NULL", stringify!($var)); - }; -} - -macro_rules! to_ref_mut { - ($ptr:ident) => {{ - assert_not_null!($ptr); - unsafe { &mut *$ptr } - }}; -} - -macro_rules! to_bytes { - ($data:ident, $len:ident) => {{ - assert_not_null!($data); - unsafe { slice::from_raw_parts($data as *const u8, $len) } - }}; -} - -macro_rules! to_str { - ($data:ident, $len:ident) => { - str::from_utf8(to_bytes!($data, $len)).into() - }; -} - -macro_rules! unwrap_or_ret { - ($expr:expr, $ret_val:expr) => { - match $expr { - Ok(v) => v, - Err(_) => { - return $ret_val; - } - } - }; -} - -macro_rules! unwrap_or_ret_err_code { - ($expr:expr) => { - unwrap_or_ret!($expr, ()) - }; -} - -#[inline] -fn to_ptr_mut(val: T) -> *mut T { - Box::into_raw(Box::new(val)) -} - -pub mod comrak_ffi; - -mod comrak_options; - -mod string; -pub use self::string::Str; diff --git a/c-api/src/string.rs b/c-api/src/string.rs deleted file mode 100644 index 442af515..00000000 --- a/c-api/src/string.rs +++ /dev/null @@ -1,36 +0,0 @@ -use super::*; - -use libc::{c_char, size_t}; - -// Can't use CStr and CString as the transfer type because UTF-8 -// strings can contain "internal" NULLs. -#[repr(C)] -pub struct Str { - data: *const c_char, - len: size_t, -} - -impl Str { - pub fn new(string: String) -> Self { - Str { - len: string.len(), - data: Box::into_raw(string.into_boxed_str()) as *const c_char, - } - } -} - -impl Drop for Str { - fn drop(&mut self) { - if self.data == ptr::null() { - return; - } - let bytes = unsafe { slice::from_raw_parts_mut(self.data as *mut c_char, self.len) }; - - drop(unsafe { Box::from_raw(bytes) }); - } -} - -#[no_mangle] -pub extern "C" fn comrak_str_free(string: Str) { - drop(string); -} diff --git a/c-api/tests/Cargo.lock b/c-api/tests/Cargo.lock deleted file mode 100644 index 0a7236db..00000000 --- a/c-api/tests/Cargo.lock +++ /dev/null @@ -1,794 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bit-set" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "comrak" -version = "0.14.0" -dependencies = [ - "clap", - "entities", - "memchr", - "once_cell", - "pest", - "pest_derive", - "regex", - "shell-words", - "syntect", - "typed-arena", - "unicode_categories", - "xdg", -] - -[[package]] -name = "comrak_ffi" -version = "0.1.0" -dependencies = [ - "cc", - "comrak", - "libc", - "paste", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "ctests" -version = "0.1.0" -dependencies = [ - "cc", - "comrak", - "comrak_ffi", - "glob", - "libc", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "entities" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fancy-regex" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" -dependencies = [ - "bit-set", - "regex", -] - -[[package]] -name = "flate2" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "getrandom" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "indexmap" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "itoa" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" - -[[package]] -name = "line-wrap" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" -dependencies = [ - "safemem", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "miniz_oxide" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" -dependencies = [ - "adler", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - -[[package]] -name = "once_cell" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" - -[[package]] -name = "onig" -version = "6.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225" -dependencies = [ - "bitflags", - "lazy_static", - "libc", - "onig_sys", -] - -[[package]] -name = "onig_sys" -version = "69.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e" -dependencies = [ - "cc", - "pkg-config", -] - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "paste" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" - -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" -dependencies = [ - "maplit", - "pest", - "sha-1", -] - -[[package]] -name = "pkg-config" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" - -[[package]] -name = "plist" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" -dependencies = [ - "base64", - "indexmap", - "line-wrap", - "serde", - "time", - "xml-rs", -] - -[[package]] -name = "proc-macro2" -version = "1.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" - -[[package]] -name = "ryu" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "serde" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" - -[[package]] -name = "serde_derive" -version = "1.0.137" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer", - "digest", - "fake-simd", - "opaque-debug", -] - -[[package]] -name = "shell-words" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "syn" -version = "1.0.96" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syntect" -version = "4.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031" -dependencies = [ - "bincode", - "bitflags", - "fancy-regex", - "flate2", - "fnv", - "lazy_static", - "lazycell", - "onig", - "plist", - "regex-syntax", - "serde", - "serde_derive", - "serde_json", - "walkdir", - "yaml-rust", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thiserror" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" -dependencies = [ - "itoa", - "libc", - "num_threads", -] - -[[package]] -name = "typed-arena" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" - -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "unicode-ident" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - -[[package]] -name = "unicode_categories" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "xdg" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" -dependencies = [ - "dirs", -] - -[[package]] -name = "xml-rs" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] diff --git a/c-api/tests/Cargo.toml b/c-api/tests/Cargo.toml deleted file mode 100644 index 0c62f992..00000000 --- a/c-api/tests/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "ctests" -version = "0.1.0" -edition = "2018" -build = "build.rs" - -[dependencies] -comrak = { path = "../../" } -comrak_ffi = { path = "../" } -libc = "0" - -[build-dependencies] -cc = "1.0.46" -glob = "0.3.0" - -[profile.release] -panic = "abort" -lto = true diff --git a/c-api/tests/build.rs b/c-api/tests/build.rs deleted file mode 100644 index 5a2fe870..00000000 --- a/c-api/tests/build.rs +++ /dev/null @@ -1,76 +0,0 @@ -use cc; -use glob::glob; -use std::path::{Path, PathBuf}; - -const CFLAGS: &'static [&str] = &[ - "-std=c99", - "-pthread", - "-Wcast-qual", - "-Wwrite-strings", - "-Wshadow", - "-Winline", - "-Wdisabled-optimization", - "-Wuninitialized", - "-Wcast-align", - "-Wcast-align", - "-Wno-missing-field-initializers", - "-Wno-address", -]; - -const SRC_DIR: &str = "src"; -const PICOTEST_DIR: &str = "src/deps/picotest"; -const INCLUDE_DIR: &str = "../include"; - -fn glob_c_files>(dirname: P) -> Vec { - const C_PATTERN: &str = "*.c"; - let cwd = std::env::current_dir().expect("failed to determine working directory"); - - glob( - dirname - .as_ref() - .join(C_PATTERN) - .to_str() - .expect("Path is not valid unicode."), - ) - .expect("Failed to read glob pattern") - .filter_map(Result::ok) - .inspect(|path| { - let relative_path = path - .strip_prefix(&cwd) - .unwrap_or(path) - .to_str() - .expect("non-ascii C source file"); - println!("cargo:rerun-if-changed={}", relative_path); - }) - .collect::>() -} - -fn main() { - let mut build = cc::Build::new(); - - for cflag in CFLAGS { - build.flag(cflag); - } - - println!("cargo:rerun-if-changed=../include/comrak.h"); - - // Collect all the C files from src/deps/picotest and src. - let mut c_files = glob_c_files(PICOTEST_DIR); - - c_files.append(&mut glob_c_files(SRC_DIR)); - - build - .debug(true) - .opt_level(0) - .flag_if_supported("-Wl,no-as-needed") - .warnings(true) - .extra_warnings(true) - .warnings_into_errors(true) - .include(INCLUDE_DIR) - .include(PICOTEST_DIR) - .files(c_files) - .compile("comrak_ctests"); - - // Link against the C API. - println!("cargo:rustc-link-lib=dylib=comrak_ffi"); -} diff --git a/c-api/tests/src/deps/picotest/picotest.c b/c-api/tests/src/deps/picotest/picotest.c deleted file mode 100644 index ddf59de8..00000000 --- a/c-api/tests/src/deps/picotest/picotest.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2014 DeNA Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -#ifdef _WINDOWS -#include "wincompat.h" -#endif -#include -#include -#include -#include "picotest.h" - -struct test_t { - int num_tests; - int failed; -}; -struct test_t main_tests, *cur_tests = &main_tests; -static int test_level = 0; - -static void indent(void) -{ - int i; - for (i = 0; i != test_level; ++i) - printf(" "); -} - -__attribute__((format (printf, 1, 2))) -void note(const char *fmt, ...) -{ - va_list arg; - - indent(); - printf("# "); - - va_start(arg, fmt); - vprintf(fmt, arg); - va_end(arg); - - printf("\n"); - fflush(stdout); -} - -__attribute__((format (printf, 2, 3))) -void _ok(int cond, const char *fmt, ...) -{ - va_list arg; - - if (! cond) - cur_tests->failed = 1; - indent(); - - printf("%s %d - ", cond ? "ok" : "not ok", ++cur_tests->num_tests); - va_start(arg, fmt); - vprintf(fmt, arg); - va_end(arg); - - printf("\n"); - fflush(stdout); -} - -int done_testing(void) -{ - indent(); - printf("1..%d\n", cur_tests->num_tests); - fflush(stdout); - return cur_tests->failed; -} - -void subtest(const char *name, void (*cb)(void)) -{ - struct test_t test = {0}, *parent_tests; - - parent_tests = cur_tests; - cur_tests = &test; - ++test_level; - - note("Subtest: %s", name); - - cb(); - - done_testing(); - - --test_level; - cur_tests = parent_tests; - if (test.failed) - cur_tests->failed = 1; - _ok(! test.failed, "%s", name); -} diff --git a/c-api/tests/src/deps/picotest/picotest.h b/c-api/tests/src/deps/picotest/picotest.h deleted file mode 100644 index c74da9da..00000000 --- a/c-api/tests/src/deps/picotest/picotest.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2014 DeNA Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ -#ifndef picotest_h -#define picotest_h - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void note(const char *fmt, ...) __attribute__((format (printf, 1, 2))); -void _ok(int cond, const char *fmt, ...) __attribute__((format (printf, 2, 3))); -#define ok(cond) _ok(cond, "%s %d", __FILE__, __LINE__) -int done_testing(void); -void subtest(const char *name, void (*cb)(void)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c-api/tests/src/main.rs b/c-api/tests/src/main.rs deleted file mode 100644 index ff67b3b6..00000000 --- a/c-api/tests/src/main.rs +++ /dev/null @@ -1,9 +0,0 @@ -//! The test runner for the C API tests. - -extern "C" { - fn run_tests() -> i32; -} - -fn main() { - unsafe { std::process::exit(run_tests()) } -} diff --git a/c-api/tests/src/test.c b/c-api/tests/src/test.c deleted file mode 100644 index ab84d6d6..00000000 --- a/c-api/tests/src/test.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include -#include -#include "deps/picotest/picotest.h" -#include "../../include/comrak_ffi.h" - -#include "test.h" - -int run_tests() { - subtest("test_comrak_basic", test_comrak_basic); - subtest("test_commonmark_extension_options", test_commonmark_extension_options); - subtest("test_commonmark_parse_options", test_commonmark_parse_options); - subtest("test_commonmark_render_options", test_commonmark_render_options); - - return done_testing(); -} - diff --git a/c-api/tests/src/test.h b/c-api/tests/src/test.h deleted file mode 100644 index d8b54463..00000000 --- a/c-api/tests/src/test.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef TESTS_H -#define TESTS_H - -#include "../../include/comrak_ffi.h" - -void test_comrak_basic(); - -void test_commonmark_extension_options(); -void test_commonmark_parse_options(); -void test_commonmark_render_options(); - -#endif // TESTS_H diff --git a/c-api/tests/src/test_comrak_basic.c b/c-api/tests/src/test_comrak_basic.c deleted file mode 100644 index 17994fba..00000000 --- a/c-api/tests/src/test_comrak_basic.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include - -#include "../../include/comrak_ffi.h" -#include "deps/picotest/picotest.h" -#include "test.h" -#include "test_util.h" - -void test_basic_commonmark() { - const char* commonmark = "Hello *world*!"; - - comrak_options_t * default_options = comrak_options_new(); - comrak_str_t html = comrak_commonmark_to_html(commonmark, default_options); - const char* expected = "

Hello world!

\n"; - - str_eq(html, expected); - - comrak_options_free(default_options); - comrak_str_free(html); -} - -void test_comrak_basic() { - test_basic_commonmark(); -} diff --git a/c-api/tests/src/test_comrak_extension_options.c b/c-api/tests/src/test_comrak_extension_options.c deleted file mode 100644 index 7236eeb5..00000000 --- a/c-api/tests/src/test_comrak_extension_options.c +++ /dev/null @@ -1,222 +0,0 @@ -#include -#include - -#include "../../include/comrak_ffi.h" -#include "deps/picotest/picotest.h" -#include "test.h" -#include "test_util.h" - -void test_commonmark_render_works_with_strikethrough() { - const char* commonmark = "Hello ~~world~~ 世界!"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_strikethrough(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "

Hello ~~world~~ 世界!

\n"; - - str_eq(html, expected); - - comrak_set_extension_option_strikethrough(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "

Hello world 世界!

\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_tagfilter() { - const char* commonmark = "hi ok\n\n<xmp>\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_tagfilter(comrak_options, true); - comrak_set_render_option_unsafe_(comrak_options, true); - - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected ="<p>hi &lt;xmp> ok</p>\n&lt;xmp>\n"; - - str_eq(html, expected); - - comrak_options_free(comrak_options); - comrak_str_free(html); -} - -void test_commonmark_render_works_with_table() { - const char* commonmark = "| a | b |\n|---|:-:|\n| c | d |\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_table(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<p>| a | b |\n|---|:-:|\n| c | d |</p>\n"; - - str_eq(html, expected); - - comrak_set_extension_option_table(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<table>\n<thead>\n<tr>\n<th>a</th>\n<th align=\"center\">b</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>c</td>\n<td align=\"center\">d</td>\n</tr>\n</tbody>\n</table>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_autolink() { - const char* commonmark = "www.autolink.com\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_autolink(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<p>www.autolink.com</p>\n"; - - str_eq(html, expected); - - comrak_set_extension_option_autolink(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<p><a href=\"http://www.autolink.com\">www.autolink.com</a></p>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_tasklist() { - const char* commonmark = "- [ ] List item 1\n- [ ] This list item is **bold**\n- [x] There is some `code` here\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_tasklist(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<ul>\n<li>[ ] List item 1</li>\n<li>[ ] This list item is <strong>bold</strong></li>\n<li>[x] There is some <code>code</code> here</li>\n</ul>\n"; - - str_eq(html, expected); - - comrak_set_extension_option_tasklist(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<ul>\n<li><input type=\"checkbox\" disabled=\"\" /> List item 1</li>\n<li><input type=\"checkbox\" disabled=\"\" /> This list item is <strong>bold</strong></li>\n<li><input type=\"checkbox\" disabled=\"\" checked=\"\" /> There is some <code>code</code> here</li>\n</ul>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_superscript() { - const char* commonmark = "e = mc^2^.\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_superscript(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<p>e = mc^2^.</p>\n"; - - str_eq(html, expected); - - comrak_set_extension_option_superscript(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<p>e = mc<sup>2</sup>.</p>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_header_ids() { - const char* commonmark = "# Hi.\n## Hi 1.\n### Hi.\n#### Hello.\n##### Hi.\n###### Hello.\n# Isn't it grand?"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_header_ids(comrak_options, "user-content-", 13); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<h1><a href=\"#hi\" aria-hidden=\"true\" class=\"anchor\" id=\"user-content-hi\"></a>Hi.</h1>\n<h2><a href=\"#hi-1\" aria-hidden=\"true\" class=\"anchor\" id=\"user-content-hi-1\"></a>Hi 1.</h2>\n<h3><a href=\"#hi-2\" aria-hidden=\"true\" class=\"anchor\" id=\"user-content-hi-2\"></a>Hi.</h3>\n<h4><a href=\"#hello\" aria-hidden=\"true\" class=\"anchor\" id=\"user-content-hello\"></a>Hello.</h4>\n<h5><a href=\"#hi-3\" aria-hidden=\"true\" class=\"anchor\" id=\"user-content-hi-3\"></a>Hi.</h5>\n<h6><a href=\"#hello-1\" aria-hidden=\"true\" class=\"anchor\" id=\"user-content-hello-1\"></a>Hello.</h6>\n<h1><a href=\"#isnt-it-grand\" aria-hidden=\"true\" class=\"anchor\" id=\"user-content-isnt-it-grand\"></a>Isn't it grand?</h1>\n"; - str_eq(html, expected); - - comrak_set_extension_option_header_ids(comrak_options, "", 0); - comrak_str_t no_prefix_id_html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* no_prefix_id_expected = "<h1><a href=\"#hi\" aria-hidden=\"true\" class=\"anchor\" id=\"hi\"></a>Hi.</h1>\n<h2><a href=\"#hi-1\" aria-hidden=\"true\" class=\"anchor\" id=\"hi-1\"></a>Hi 1.</h2>\n<h3><a href=\"#hi-2\" aria-hidden=\"true\" class=\"anchor\" id=\"hi-2\"></a>Hi.</h3>\n<h4><a href=\"#hello\" aria-hidden=\"true\" class=\"anchor\" id=\"hello\"></a>Hello.</h4>\n<h5><a href=\"#hi-3\" aria-hidden=\"true\" class=\"anchor\" id=\"hi-3\"></a>Hi.</h5>\n<h6><a href=\"#hello-1\" aria-hidden=\"true\" class=\"anchor\" id=\"hello-1\"></a>Hello.</h6>\n<h1><a href=\"#isnt-it-grand\" aria-hidden=\"true\" class=\"anchor\" id=\"isnt-it-grand\"></a>Isn't it grand?</h1>\n"; - str_eq(no_prefix_id_html, no_prefix_id_expected); - - comrak_set_extension_option_header_ids(comrak_options, NULL, 0); - comrak_str_t no_id_html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* no_id_expected = "<h1>Hi.</h1>\n<h2>Hi 1.</h2>\n<h3>Hi.</h3>\n<h4>Hello.</h4>\n<h5>Hi.</h5>\n<h6>Hello.</h6>\n<h1>Isn't it grand?</h1>\n"; - str_eq(no_id_html, no_id_expected); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(no_prefix_id_html); - comrak_str_free(no_id_html); -} - -void test_commonmark_render_works_with_footnotes() { - const char* commonmark = "Here is a[^nowhere] footnote reference,[^1] and another.[^longnote]\n\nThis is another note.[^note]\n\n[^note]: Hi.\n\n[^1]: Here is the footnote.\n\n[^longnote]: Here's one with multiple blocks.\n\n Subsequent paragraphs are indented.\n\n code\n\nThis is regular content.\n\n[^unused]: This is not used.\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_footnotes(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<p>Here is a[^nowhere] footnote reference,[^1] and another.[^longnote]</p>\n<p>This is another note.<a href=\"Hi.\">^note</a></p>\n<p>[^1]: Here is the footnote.</p>\n<p>[^longnote]: Here's one with multiple blocks.</p>\n<pre><code>Subsequent paragraphs are indented.\n\n code\n</code></pre>\n<p>This is regular content.</p>\n<p>[^unused]: This is not used.</p>\n"; - - str_eq(html, expected); - - comrak_set_extension_option_footnotes(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<p>Here is a[^nowhere] footnote reference,<sup class=\"footnote-ref\"><a href=\"#fn1\" id=\"fnref1\">1</a></sup> and another.<sup class=\"footnote-ref\"><a href=\"#fn2\" id=\"fnref2\">2</a></sup></p>\n<p>This is another note.<sup class=\"footnote-ref\"><a href=\"#fn3\" id=\"fnref3\">3</a></sup></p>\n<p>This is regular content.</p>\n<section class=\"footnotes\">\n<ol>\n<li id=\"fn1\">\n<p>Here is the footnote. <a href=\"#fnref1\" class=\"footnote-backref\">↩</a></p>\n</li>\n<li id=\"fn2\">\n<p>Here's one with multiple blocks.</p>\n<p>Subsequent paragraphs are indented.</p>\n<pre><code>code\n</code></pre>\n<a href=\"#fnref2\" class=\"footnote-backref\">↩</a>\n</li>\n<li id=\"fn3\">\n<p>Hi. <a href=\"#fnref3\" class=\"footnote-backref\">↩</a></p>\n</li>\n</ol>\n</section>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_description_lists() { - const char* commonmark = "Term 1\n\n: Definition 1\n\nTerm 2 with *inline markup*\n\n: Definition 2\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_description_lists(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<p>Term 1</p>\n<p>: Definition 1</p>\n<p>Term 2 with <em>inline markup</em></p>\n<p>: Definition 2</p>\n"; - - str_eq(html, expected); - - comrak_set_extension_option_description_lists(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<dl><dt>Term 1</dt>\n<dd>\n<p>Definition 1</p>\n</dd>\n<dt>Term 2 with <em>inline markup</em></dt>\n<dd>\n<p>Definition 2</p>\n</dd>\n</dl>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_front_matter_delimiter() { - const char* commonmark = "---\nlayout: post\n---\nText\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_extension_option_front_matter_delimiter(comrak_options, "---", 3); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<p>Text</p>\n"; - - str_eq(html, expected); - - comrak_options_free(comrak_options); - comrak_str_free(html); -} - -void test_commonmark_extension_options() { - test_commonmark_render_works_with_strikethrough(); - test_commonmark_render_works_with_tagfilter(); - test_commonmark_render_works_with_table(); - test_commonmark_render_works_with_autolink(); - test_commonmark_render_works_with_tasklist(); - test_commonmark_render_works_with_superscript(); - test_commonmark_render_works_with_header_ids(); - test_commonmark_render_works_with_footnotes(); - test_commonmark_render_works_with_description_lists(); - test_commonmark_render_works_with_front_matter_delimiter(); -} diff --git a/c-api/tests/src/test_comrak_parse_options.c b/c-api/tests/src/test_comrak_parse_options.c deleted file mode 100644 index ddcf6931..00000000 --- a/c-api/tests/src/test_comrak_parse_options.c +++ /dev/null @@ -1,47 +0,0 @@ -#include <string.h> -#include <stdio.h> - -#include "../../include/comrak_ffi.h" -#include "deps/picotest/picotest.h" -#include "test.h" -#include "test_util.h" - -void test_commonmark_render_works_with_smart() { - const char* commonmark = "'Hello,' \"world\" ..."; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_parse_option_smart(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<p>'Hello,' &quot;world&quot; ...</p>\n"; - - str_eq(html, expected); - - comrak_set_parse_option_smart(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<p>‘Hello,’ “world” …</p>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_default_info_string() { - const char* commonmark = "```\nfn hello();\n```\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_parse_option_default_info_string(comrak_options, "rust", 4); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<pre><code class=\"language-rust\">fn hello();\n</code></pre>\n"; - - str_eq(html, expected); - - comrak_options_free(comrak_options); - comrak_str_free(html); -} - -void test_commonmark_parse_options() { - test_commonmark_render_works_with_smart(); - test_commonmark_render_works_with_default_info_string(); -} diff --git a/c-api/tests/src/test_comrak_render_options.c b/c-api/tests/src/test_comrak_render_options.c deleted file mode 100644 index c356df31..00000000 --- a/c-api/tests/src/test_comrak_render_options.c +++ /dev/null @@ -1,119 +0,0 @@ -#include <string.h> -#include <stdio.h> - -#include "../../include/comrak_ffi.h" -#include "deps/picotest/picotest.h" -#include "test.h" -#include "test_util.h" - -void test_commonmark_render_works_with_hardbreaks() { - const char* commonmark = ">\\\n A"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_render_option_hardbreaks(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<blockquote>\n<p><br />\nA</p>\n</blockquote>\n"; - - str_eq(html, expected); - - comrak_set_render_option_hardbreaks(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<blockquote>\n<p><br />\nA</p>\n</blockquote>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_github_pre_lang() { - const char* commonmark = "``` rust\nfn hello();\n```\n"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_render_option_github_pre_lang(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<pre><code class=\"language-rust\">fn hello();\n</code></pre>\n"; - - str_eq(html, expected); - - comrak_set_render_option_github_pre_lang(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<pre lang=\"rust\"><code>fn hello();\n</code></pre>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_width() { - const char* commonmark = "hello hello hello hello hello hello"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_str_t roundtrip = comrak_commonmark_to_commonmark(commonmark, comrak_options); - const char* expected = "hello hello hello hello hello hello\n"; - - str_eq(roundtrip, expected); - - comrak_set_render_option_width(comrak_options, 20); - comrak_str_t roundtrip_w_width = comrak_commonmark_to_commonmark(commonmark, comrak_options); - const char* expected_w_width ="hello hello hello\nhello hello hello\n"; - - str_eq(roundtrip_w_width, expected_w_width); - - comrak_options_free(comrak_options); - comrak_str_free(roundtrip); - comrak_str_free(roundtrip_w_width); -} - -void test_commonmark_render_works_with_unsafe_() { - const char* commonmark = "<script>\nalert('xyz');\n</script>"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_render_option_unsafe_(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected = "<!-- raw HTML omitted -->\n"; - - str_eq(html, expected); - - comrak_set_render_option_unsafe_(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<script>\nalert(\'xyz\');\n</script>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_works_with_escape() { - const char* commonmark = "<i>italic text</i>"; - comrak_options_t * comrak_options = comrak_options_new(); - - comrak_set_render_option_escape(comrak_options, false); - comrak_str_t html = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected ="<p><!-- raw HTML omitted -->italic text<!-- raw HTML omitted --></p>\n"; - - str_eq(html, expected); - - comrak_set_render_option_escape(comrak_options, true); - comrak_str_t html_w_extension = comrak_commonmark_to_html(commonmark, comrak_options); - const char* expected_w_extension = "<p>&lt;i&gt;italic text&lt;/i&gt;</p>\n"; - - str_eq(html_w_extension, expected_w_extension); - - comrak_options_free(comrak_options); - comrak_str_free(html); - comrak_str_free(html_w_extension); -} - -void test_commonmark_render_options() { - test_commonmark_render_works_with_hardbreaks(); - test_commonmark_render_works_with_github_pre_lang(); - test_commonmark_render_works_with_width(); - test_commonmark_render_works_with_unsafe_(); - test_commonmark_render_works_with_escape(); -} diff --git a/c-api/tests/src/test_util.h b/c-api/tests/src/test_util.h deleted file mode 100644 index 230e9bd6..00000000 --- a/c-api/tests/src/test_util.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef TEST_UTIL_H -#define TEST_UTIL_H - -#include <stdlib.h> -#include <string.h> - -#include "../../include/comrak_ffi.h" - -#define str_eq(actual, expected) { \ - ok((actual).data != NULL); \ - ok((actual).len == strlen(expected)); \ - ok(!memcmp((actual).data, expected, (actual).len)); \ -} - -#endif // TEST_UTIL_H diff --git a/script/cibuild b/script/cibuild index e04a8b50..3f0ae560 100755 --- a/script/cibuild +++ b/script/cibuild @@ -18,7 +18,5 @@ if [ x"$SPEC" = "xtrue" ]; then python3 entity_tests.py --program='../../../target/debug/comrak --syntax-highlighting none' else cargo test --verbose - echo "=== Running C API tests... ===" - cargo run --manifest-path=./c-api/tests/Cargo.toml cargo run --example sample fi