From f2827899bf188dfcd8cb22284e6b02a4946b1fa5 Mon Sep 17 00:00:00 2001 From: Zak Henry Date: Tue, 11 Feb 2020 11:50:50 +0000 Subject: [PATCH] feat(Arduino): Support arduino .ino files --- test/fixtures/fixture-in-place.md | 16 +++++ test/snapshots/test.ts.md | 99 +++++++++++++++++------------- test/snapshots/test.ts.snap | Bin 3072 -> 3107 bytes 3 files changed, 74 insertions(+), 41 deletions(-) diff --git a/test/fixtures/fixture-in-place.md b/test/fixtures/fixture-in-place.md index a2d0076..3c85f83 100644 --- a/test/fixtures/fixture-in-place.md +++ b/test/fixtures/fixture-in-place.md @@ -74,6 +74,22 @@ int main() ``` +Arduino + +```cpp +// snippets/sample.ino + +#include +using namespace std; + +int main() +{ + cout << "Hello, World!"; + return 0; +} + +``` + C ```c diff --git a/test/snapshots/test.ts.md b/test/snapshots/test.ts.md index 232d7a6..1d6c363 100644 --- a/test/snapshots/test.ts.md +++ b/test/snapshots/test.ts.md @@ -84,6 +84,22 @@ Generated by [AVA](https://ava.li). ␊ ```␊ ␊ + Arduino␊ + ␊ + ```cpp␊ + // snippets/sample.ino␊ + ␊ + #include ␊ + using namespace std;␊ + ␊ + int main()␊ + {␊ + cout << "Hello, World!";␊ + return 0;␊ + }␊ + ␊ + ```␊ + ␊ C␊ ␊ ```c␊ @@ -537,47 +553,48 @@ Generated by [AVA](https://ava.li). test/fixtures/fixture-in-place.md#L43-L48 Embedded 2 lines from file snippets/sample.py␊ test/fixtures/fixture-in-place.md#L52-L59 Embedded 4 lines from file snippets/sample.rs␊ test/fixtures/fixture-in-place.md#L63-L75 Embedded 9 lines from file snippets/sample.cpp␊ - test/fixtures/fixture-in-place.md#L79-L90 Embedded 8 lines from file snippets/sample.c␊ - test/fixtures/fixture-in-place.md#L94-L106 Embedded 9 lines from file snippets/sample.java␊ - test/fixtures/fixture-in-place.md#L110-L121 Embedded 8 lines from file snippets/sample.go␊ - test/fixtures/fixture-in-place.md#L125-L131 Embedded 3 lines from file snippets/sample.sh␊ - test/fixtures/fixture-in-place.md#L135-L141 Embedded 3 lines from file snippets/sample.sh␊ - test/fixtures/fixture-in-place.md#L145-L157 Embedded 9 lines from file snippets/sample.m␊ - test/fixtures/fixture-in-place.md#L161-L170 Embedded 6 lines from file snippets/sample.scss␊ - test/fixtures/fixture-in-place.md#L174-L181 Embedded 4 lines from file snippets/sample.php␊ - test/fixtures/fixture-in-place.md#L185-L204 Embedded 16 lines from file snippets/sample.cs␊ - test/fixtures/fixture-in-place.md#L208-L213 Embedded 2 lines from file snippets/sample.swift␊ - test/fixtures/fixture-in-place.md#L217-L224 Embedded 4 lines from file snippets/sample.xml␊ - test/fixtures/fixture-in-place.md#L228-L234 Embedded 3 lines from file snippets/sample.yaml␊ - test/fixtures/fixture-in-place.md#L240-L245 Embedded 4 lines from file snippets/sample.json␊ - test/fixtures/fixture-in-place.md#L249-L256 Embedded 4 lines from file snippets/sample.json5␊ - test/fixtures/fixture-in-place.md#L260-L265 Embedded 2 lines from file snippets/sample.rb␊ - test/fixtures/fixture-in-place.md#L269-L274 Embedded 2 lines from file snippets/sample.cr␊ - test/fixtures/fixture-in-place.md#L278-L285 Embedded 4 lines from file snippets/sample.kt␊ - test/fixtures/fixture-in-place.md#L289-L298 Embedded 6 lines from file snippets/sample.scala␊ - test/fixtures/fixture-in-place.md#L302-L312 Embedded 7 lines from file snippets/sample.puml␊ - test/fixtures/fixture-in-place.md#L316-L329 Embedded 10 lines from file snippets/sample.mermaid␊ - test/fixtures/fixture-in-place.md#L333-L346 Embedded 10 lines from file snippets/sample.proto␊ - test/fixtures/fixture-in-place.md#L350-L357 Embedded 4 lines from file snippets/sample.cmake␊ - test/fixtures/fixture-in-place.md#L361-L367 Embedded 3 lines from file snippets/sample.sql␊ - test/fixtures/fixture-in-place.md#L371-L376 Embedded 2 lines from file snippets/sample.hs␊ - test/fixtures/fixture-in-place.md#L380-L386 Embedded 3 lines from file snippets/sample␊ - test/fixtures/fixture-in-place.md#L390-L401 Embedded 8 lines from file snippets/sample.cs#L6-L13␊ - test/fixtures/fixture-in-place.md#L405-L412 Embedded 4 lines from file snippets/sample.ts␊ - test/fixtures/fixture-in-place.md#L418-L420 "Ignore next" comment detected, skipping code block...␊ - test/fixtures/fixture-in-place.md#L426-L428 "Ignore next" comment detected, skipping code block...␊ - test/fixtures/fixture-in-place.md#L434-L439 Embedded 4 lines from file snippets/sample.ts␊ - test/fixtures/fixture-in-place.md#L445-L450 Embedded 4 lines from file snippets/sample.json␊ - test/fixtures/fixture-in-place.md#L456-L457 Code block is empty & no preceding embedme comment, skipping...␊ - test/fixtures/fixture-in-place.md#L461-L463 Unsupported file extension [binary], supported extensions are txt, ts, js, scss, rust, java, cpp, c, html, xml, md, yaml, json, json5, py, bash, sh, go, objectivec, php, cs, swift, rb, kotlin, scala, cr, puml, mermaid, cmake, proto, sql, hs, skipping code block␊ - test/fixtures/fixture-in-place.md#L467-L469 No code extension detected, skipping code block...␊ - test/fixtures/fixture-in-place.md#L473-L475 No comment detected in first line for block with extension ts␊ - test/fixtures/fixture-in-place.md#L479-L481 Found filename also-not-a-file in comment in first line, but file does not exist at ${cwd}/test/fixtures/also-not-a-file!␊ - test/fixtures/fixture-in-place.md#L485-L487 Found filename this-file-does-not-exist.txt in comment in first line, but file does not exist at ${cwd}/test/fixtures/this-file-does-not-exist.txt!␊ - test/fixtures/fixture-in-place.md#L491-L493 Found filename contains-codefence.md in comment in first line, but file does not exist at ${cwd}/test/fixtures/contains-codefence.md!␊ - test/fixtures/fixture-in-place.md#L497-L503 Found filename contains-codefence.md in comment in first line, but file does not exist at ${cwd}/test/fixtures/contains-codefence.md!␊ - test/fixtures/fixture-in-place.md#L507-L509 Incorrectly formatted line numbering string snippets/sample.ts#L1-2, Expecting Github formatting e.g. #L10-L20␊ - test/fixtures/fixture-in-place.md#L513-L515 Code block is empty & no preceding embedme comment, skipping...␊ + test/fixtures/fixture-in-place.md#L79-L91 Embedded 9 lines from file snippets/sample.ino␊ + test/fixtures/fixture-in-place.md#L95-L106 Embedded 8 lines from file snippets/sample.c␊ + test/fixtures/fixture-in-place.md#L110-L122 Embedded 9 lines from file snippets/sample.java␊ + test/fixtures/fixture-in-place.md#L126-L137 Embedded 8 lines from file snippets/sample.go␊ + test/fixtures/fixture-in-place.md#L141-L147 Embedded 3 lines from file snippets/sample.sh␊ + test/fixtures/fixture-in-place.md#L151-L157 Embedded 3 lines from file snippets/sample.sh␊ + test/fixtures/fixture-in-place.md#L161-L173 Embedded 9 lines from file snippets/sample.m␊ + test/fixtures/fixture-in-place.md#L177-L186 Embedded 6 lines from file snippets/sample.scss␊ + test/fixtures/fixture-in-place.md#L190-L197 Embedded 4 lines from file snippets/sample.php␊ + test/fixtures/fixture-in-place.md#L201-L220 Embedded 16 lines from file snippets/sample.cs␊ + test/fixtures/fixture-in-place.md#L224-L229 Embedded 2 lines from file snippets/sample.swift␊ + test/fixtures/fixture-in-place.md#L233-L240 Embedded 4 lines from file snippets/sample.xml␊ + test/fixtures/fixture-in-place.md#L244-L250 Embedded 3 lines from file snippets/sample.yaml␊ + test/fixtures/fixture-in-place.md#L256-L261 Embedded 4 lines from file snippets/sample.json␊ + test/fixtures/fixture-in-place.md#L265-L272 Embedded 4 lines from file snippets/sample.json5␊ + test/fixtures/fixture-in-place.md#L276-L281 Embedded 2 lines from file snippets/sample.rb␊ + test/fixtures/fixture-in-place.md#L285-L290 Embedded 2 lines from file snippets/sample.cr␊ + test/fixtures/fixture-in-place.md#L294-L301 Embedded 4 lines from file snippets/sample.kt␊ + test/fixtures/fixture-in-place.md#L305-L314 Embedded 6 lines from file snippets/sample.scala␊ + test/fixtures/fixture-in-place.md#L318-L328 Embedded 7 lines from file snippets/sample.puml␊ + test/fixtures/fixture-in-place.md#L332-L345 Embedded 10 lines from file snippets/sample.mermaid␊ + test/fixtures/fixture-in-place.md#L349-L362 Embedded 10 lines from file snippets/sample.proto␊ + test/fixtures/fixture-in-place.md#L366-L373 Embedded 4 lines from file snippets/sample.cmake␊ + test/fixtures/fixture-in-place.md#L377-L383 Embedded 3 lines from file snippets/sample.sql␊ + test/fixtures/fixture-in-place.md#L387-L392 Embedded 2 lines from file snippets/sample.hs␊ + test/fixtures/fixture-in-place.md#L396-L402 Embedded 3 lines from file snippets/sample␊ + test/fixtures/fixture-in-place.md#L406-L417 Embedded 8 lines from file snippets/sample.cs#L6-L13␊ + test/fixtures/fixture-in-place.md#L421-L428 Embedded 4 lines from file snippets/sample.ts␊ + test/fixtures/fixture-in-place.md#L434-L436 "Ignore next" comment detected, skipping code block...␊ + test/fixtures/fixture-in-place.md#L442-L444 "Ignore next" comment detected, skipping code block...␊ + test/fixtures/fixture-in-place.md#L450-L455 Embedded 4 lines from file snippets/sample.ts␊ + test/fixtures/fixture-in-place.md#L461-L466 Embedded 4 lines from file snippets/sample.json␊ + test/fixtures/fixture-in-place.md#L472-L473 Code block is empty & no preceding embedme comment, skipping...␊ + test/fixtures/fixture-in-place.md#L477-L479 Unsupported file extension [binary], supported extensions are txt, ts, js, scss, rust, java, cpp, c, html, xml, md, yaml, json, json5, py, bash, sh, go, objectivec, php, cs, swift, rb, kotlin, scala, cr, puml, mermaid, cmake, proto, sql, hs, ino, skipping code block␊ + test/fixtures/fixture-in-place.md#L483-L485 No code extension detected, skipping code block...␊ + test/fixtures/fixture-in-place.md#L489-L491 No comment detected in first line for block with extension ts␊ + test/fixtures/fixture-in-place.md#L495-L497 Found filename also-not-a-file in comment in first line, but file does not exist at ${cwd}/test/fixtures/also-not-a-file!␊ + test/fixtures/fixture-in-place.md#L501-L503 Found filename this-file-does-not-exist.txt in comment in first line, but file does not exist at ${cwd}/test/fixtures/this-file-does-not-exist.txt!␊ + test/fixtures/fixture-in-place.md#L507-L509 Found filename contains-codefence.md in comment in first line, but file does not exist at ${cwd}/test/fixtures/contains-codefence.md!␊ + test/fixtures/fixture-in-place.md#L513-L519 Found filename contains-codefence.md in comment in first line, but file does not exist at ${cwd}/test/fixtures/contains-codefence.md!␊ + test/fixtures/fixture-in-place.md#L523-L525 Incorrectly formatted line numbering string snippets/sample.ts#L1-2, Expecting Github formatting e.g. #L10-L20␊ + test/fixtures/fixture-in-place.md#L529-L531 Code block is empty & no preceding embedme comment, skipping...␊ Writing test/fixtures/fixture-in-place.md with embedded changes.␊ ` diff --git a/test/snapshots/test.ts.snap b/test/snapshots/test.ts.snap index 359c363ff8613fc4f4bcbb612ba93a2551a68d78..3155f2fabf9893b869b89e25ce07b1a855140835 100644 GIT binary patch literal 3107 zcmV+;4BYcURzV2!*o+L`qHOf{9%kQ51$q9`kh9Yu-V(6%btbu+FfSprKECV-`Zg+)%r z)0rH5?7jDXn0|!x+*`juFMV$pAV3lpfz<9yH6pp#ef!(DZ{NRtWMgM%=e?cp|MJ(r zfB(*pU*@fVHEk6bc7ER?z&?C-~>V$IQ|&EH2?xGqriu~do%`5 zMc~?dw~g2FQom)dSZ1jgxl3WMVF^DJ*mlKue+BE{b_{jz@q@lCITuO|_l9Sba%g&`2Hso&yWUVWL-{H+D&U zhO45ifD~$fk_VpSGZ(HM-xk;P<;1}vl-#T1In-nQT-|BBQNaBrTl_+}%pa?VvB=vZ z_8NHVQ#R&`Z9I5S`H;%UlNB@!bS0~%f&KN%Wcf*IvXz77s-LoOqMG=zX|FW4d+RU? zgTtZYA9DW{3~7Se6J+cyMjOx~Zx8O#@C8Tj_=Z(V&swHyzxrlsQ>Dpo1 zB-KrIml}B9Ru#xUO0Xs@fZtHpt7p#>3Ep9m6ajZR3;9e4H=`R52YvLXcXAaN&o$rF z2Iqr;mX8(Y`fJs1)b(M}V)g4-g9&gb0-FaX(45TyT{`M-z-?Ob^>T&Fdzae(PI6rf zbsMLj(8o`?H4$-eN%+U`@=4;%&v&(7$mJ7zV{fEY{kD;MrPS~ef0WvzdQOFyHN^+o zqa;Hq5&fOVG3;sJNZxmRzUl5)=#k|wIiD#jjpJWzq#$P8N0$UPA4X&Fgw5;Qmbwf$ zZh-jb4kR@{6+@_K+y!wcp^cJVoH*uoH$4W3|!%lPlv(b88tvU9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