diff --git a/.gitattributes b/.gitattributes index dfe0770..56f9680 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,6 @@ # Auto detect text files and perform LF normalization * text=auto + +# Keep the fixtures and their snapshots byte for byte, they are compared as is +examples/languages/** -text +tests/snapshots/** -text diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8e82fce --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read # for checkout + +jobs: + test: + name: test + runs-on: ubuntu-latest + steps: + - name: Setup Repo + uses: actions/checkout@v6 + + - name: Setup Node + uses: actions/setup-node@v6 + with: + cache: npm + node-version: lts/* + + - run: npm clean-install + - run: npm test diff --git a/package.json b/package.json index 91e8727..9d359aa 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "example": "examples" }, "scripts": { - "build": "bash .github/workflows/build.sh" + "build": "bash .github/workflows/build.sh", + "test": "node --test tests/*.test.js" }, "repository": { "type": "git", diff --git a/tests/languages.test.js b/tests/languages.test.js new file mode 100644 index 0000000..cd246af --- /dev/null +++ b/tests/languages.test.js @@ -0,0 +1,26 @@ +import { test } from 'node:test'; +import { strictEqual } from 'node:assert'; +import { readdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { tokenize } from '../src/index.js'; + +let fixtures = new URL('../examples/languages/', import.meta.url), + snapshots = new URL('./snapshots/', import.meta.url); + +for (let file of readdirSync(fixtures).filter(file => /^(test|oneline)\./.test(file))) + test(file, async () => { + let src = readFileSync(new URL(file, fixtures), 'utf8'), + snapshot = new URL(`${file}.txt`, snapshots), + tokens = []; + + await tokenize(src, file.slice(file.indexOf('.') + 1), (str, token) => tokens.push([token, str])); + + // checked before UPDATE so a refreshed snapshot can never bless dropped code + strictEqual(tokens.map(([, str]) => str).join(''), src); + + let got = tokens.filter(([, str]) => str).map(([token, str]) => `${token ?? '.'}\t${JSON.stringify(str)}`).join('\n'); + + if (process.env.UPDATE) + writeFileSync(snapshot, got); + else + strictEqual(got, readFileSync(snapshot, 'utf8')); + }); diff --git a/tests/snapshots/oneline.bash.txt b/tests/snapshots/oneline.bash.txt new file mode 100644 index 0000000..e3c4357 --- /dev/null +++ b/tests/snapshots/oneline.bash.txt @@ -0,0 +1,3 @@ +func "echo" +. " " +str "\"hello world\"" \ No newline at end of file diff --git a/tests/snapshots/oneline.http.txt b/tests/snapshots/oneline.http.txt new file mode 100644 index 0000000..e66d023 --- /dev/null +++ b/tests/snapshots/oneline.http.txt @@ -0,0 +1,2 @@ +kwd "GET" +. " /path/to/file.js" \ No newline at end of file diff --git a/tests/snapshots/test.asm.txt b/tests/snapshots/test.asm.txt new file mode 100644 index 0000000..824ae4f --- /dev/null +++ b/tests/snapshots/test.asm.txt @@ -0,0 +1,83 @@ +func "global" +kwd " main" +. "\n\n" +func "extern" +kwd " printf" +. "\n\n" +func "section" +kwd " .data" +. "\n" +kwd "\tfmt" +. ": db " +str "'Res: %s'" +. "," +num "0x0a" +. ", " +num "0" +. "\n" +kwd "\tmsg" +. ": db " +str "'Hello world!'" +. "," +num "0" +. "\n\n" +func "section" +kwd " .text" +. "\n" +kwd "\tmain" +. ":\n" +kwd "\tmov" +. " rsi, msg " +cmnt "; ABI is rdi, rsi" +. "\n" +kwd "\tmov" +. " rdi, fmt\n" +kwd "\tmov" +. " rax, " +num "0" +. " " +cmnt "; rax is # of non-int args" +. "\n\n" +kwd "\tcall" +. " printf\n\n\t" +cmnt "# https://github.com/speed-highlight/core/issues/39" +. "\n" +kwd "\tvmovddup" +. "\t" +num "2536" +. "(" +oper "%" +. "rbx," +oper "%" +. "rax), " +oper "%" +. "xmm1 " +cmnt "# comment" +. "\n" +kwd "\tvmovaps" +. "\t" +num "2528" +. "(" +oper "%" +. "rbx," +oper "%" +. "rax), " +oper "%" +. "xmm3\n" +kwd "\tvfmadd213ps" +. "\t" +oper "%" +. "xmm6, " +oper "%" +. "xmm5, " +oper "%" +. "xmm3\n" +kwd "\tvpslld" +. "\t" +num "$23" +. ", " +oper "%" +. "xmm4, " +oper "%" +. "xmm4\n\n" +kwd "\tret" \ No newline at end of file diff --git a/tests/snapshots/test.bash.txt b/tests/snapshots/test.bash.txt new file mode 100644 index 0000000..8b9bef0 --- /dev/null +++ b/tests/snapshots/test.bash.txt @@ -0,0 +1,142 @@ +cmnt "#!/bin/bash" +. "\n\n" +func "git" +. " commit " +kwd "&&" +. " " +func "git" +. " push\n" +func "git" +. " commit " +kwd "||" +. " " +func "echo" +. " " +str "\"Commit failed\"" +. "\n\n" +func "set" +kwd " -euo" +. " pipefail\n" +var "IFS" +oper "=" +. "$" +str "'\\n\\t'" +. "\n\n" +func "npm" +. " " +kwd "install" +. " speed_highlight_js\n\n" +var "TEST" +oper "=" +num "5" +. "\n\n" +var "HELLO_WORLD" +oper "=" +str "\"John\"" +. "\n" +func "echo" +. " " +str "\"Hi " +var "$NAME" +str "\"" +. " " +cmnt "#=> Hi John" +. "\n" +func "cat" +. " " +str "'Hi " +var "$NAME" +str "'" +cmnt "#=> " +err "TODO" +cmnt " Hi $NAME" +. "\n\n" +func "printf" +. " " +str "\"I'm in " +var "$(pwd)" +str "\"" +. "\n" +func "echo" +. " " +str "\"I'm in `pwd`\"" +. " " +kwd "|" +. " " +func "grep" +. "\n" +cmnt "# Same" +. "\n\n" +kwd "if" +. " [[" +kwd " -z" +. " " +str "\"" +var "$string" +str "\"" +. " ]]" +kwd ";" +. " " +kwd "then" +. "\n " +func "cd" +. " " +str "\"String is empty\"" +. "\n" +kwd "elif" +. " [[" +kwd " -n" +. " " +str "\"" +var "$string" +str "\"" +. " ]]" +kwd ";" +. " " +kwd "then" +. "\n " +func "alias" +. " " +str "\"String is not empty\"" +. "\n" +kwd "fi" +. "\n\n" +func "minify_file" +. " " +oper "()" +. " " +oper "{" +. "\n\t" +var "file" +oper "=" +var "$1" +. "\n\t" +var "test" +oper "=" +. "false\n\t" +var "out" +oper "=" +var "${ file/${in_dir}" +. "/" +var "${out_dir}" +. " " +oper "}" +. "\n\t" +func "exec_minify_cmd" +. " " +var "$file" +. " " +var "$out" +. "\n\t" +func "test-hello" +. " " +kwd "&" +. "\n\t" +oper "./a.out" +. " test-hello\n\t" +func "cat" +. " " +oper "/etc/test" +. "\n" +oper "}" +. "\n" \ No newline at end of file diff --git a/tests/snapshots/test.bf.txt b/tests/snapshots/test.bf.txt new file mode 100644 index 0000000..7fe1ad9 --- /dev/null +++ b/tests/snapshots/test.bf.txt @@ -0,0 +1,62 @@ +oper "++" +. " " +cmnt "Cell c0 = 2" +. "\n" +kwd ">" +. " " +oper "+++++" +. " " +cmnt "Cell c1 = 5" +. "\n\n[ " +cmnt "Start your loops with your cell pointer on the loop counter (c1 in our case)" +. "\n" +kwd "<" +. " " +oper "+" +. " " +cmnt "Add 1 to c0" +. "\n" +kwd ">" +. " " +oper "-" +. " " +cmnt "Subtract 1 from c1" +. "\n] " +cmnt "End your loops with the cell pointer on the loop counter" +. "\n\n" +cmnt "At this point our program has added 5 to 2 leaving 7 in c0 and 0 in c1" +. "\n" +cmnt "but we cannot output this value to the terminal since it is not ASCII encoded." +. "\n\n" +cmnt "To display the ASCII character \"7\" we must add 48 to the value 7." +. "\n" +cmnt "We use a loop to compute 48 = 6 * 8." +. "\n\n" +oper "++++" +. " " +oper "++++" +. " " +cmnt "c1 = 8 and this will be our loop counter again" +. "\n[\n" +kwd "<" +. " " +oper "+++" +. " " +oper "+++" +. " " +cmnt "Add 6 to c0" +. "\n" +kwd ">" +. " " +oper "-" +. " " +cmnt "Subtract 1 from c1" +. "\n]\n" +kwd "<" +. " " +func "." +. " " +cmnt "Print out c0 which has the value 55 which translates to \"7\"!" +. "\n" +err "TODO" +cmnt " ..." \ No newline at end of file diff --git a/tests/snapshots/test.c.txt b/tests/snapshots/test.c.txt new file mode 100644 index 0000000..bfa1909 --- /dev/null +++ b/tests/snapshots/test.c.txt @@ -0,0 +1,192 @@ +kwd "#include " +str "" +. "\n" +kwd "#include " +str "\"my_function_function1.h\"" +. "\n\n" +kwd "#define" +. " " +class "TEST_FUNCTION" +. " my_function_function1\n\n" +kwd "#pragma" +. " " +class "GCC" +. " diagnostic ignored " +str "\"-Wunused-parameter\"" +. "\n\n" +cmnt "//some random code example\n" +. "\n" +kwd "int" +. " " +func "fibonaaci" +. "(" +kwd "int" +. " n) {\n\t" +kwd "if" +. " (n " +oper "==" +. " " +num "0" +. ") {\n\t\t" +kwd "return" +. " " +num "0" +. ";\n\t} " +kwd "else" +. " " +kwd "if" +. " (n " +oper "==" +. " " +num "1" +. ") {\n\t\t" +kwd "return" +. " " +num "1" +. ";\n\t} " +kwd "else" +. " {\n\t\t" +kwd "return" +. " " +func "fibonaaci" +. "(n " +oper "-" +. " " +num "1" +. ") " +oper "+" +. " " +func "fibonaaci" +. "(n " +oper "-" +. " " +num "2" +. ");\n\t}\n}\n\n" +kwd "typedef" +. " " +kwd "struct" +. " {\n\t" +kwd "int" +. " x;\n\t" +kwd "int" +. " y;\n} " +class "Point" +. ";\n\n" +cmnt "/*\n * This is a comment\n */" +. "\n\n" +kwd "int" +. "\t" +func "main" +. "(" +kwd "int" +. " argc" +oper "," +. " " +kwd "char" +. " " +kwd "*" +kwd "*" +. "argv)\n{\n\t" +func "printf" +. "(" +str "\"Hello World!\\n\"" +. ");\n\n\t" +class "Point" +. " pTest;\n\n\t" +kwd "asm" +. "(" +str "\"movl $1, %0\"" +. " " +oper ":" +. " " +str "\"=r\"" +. "(p" +oper "." +. "x));\n\t" +kwd "asm" +. " {" +. "\n" +kwd "\t\tmovl" +. " " +num "$2" +. ", " +oper "%" +. "eax\n" +kwd "\t\tmovl" +. " " +oper "%" +. "eax, " +oper "%" +. "ebx\n" +kwd "\t\tmovl" +. " " +oper "%" +. "ebx, " +oper "%" +. "ecx\n" +kwd "\t\tmovl" +. " " +oper "%" +. "ecx, " +oper "%" +. "edx\n" +kwd "\t\tmovl" +. " " +oper "%" +. "edx, " +oper "%" +. "esi\n" +kwd "\t\tmovl" +. " " +oper "%" +. "esi, " +oper "%" +. "edi\n" +kwd "\t\tmovl" +. " " +oper "%" +. "edi, " +oper "%" +. "ebp\n" +kwd "\t\tmovl" +. " " +oper "%" +. "ebp, " +oper "%" +. "esp\n\t" +. "}" +. "\n\n\t" +func "printf" +. "(" +str "\"%d\\n\"" +oper "," +. " " +func "fibonaaci" +. "(" +num "10" +. "));\n\n\targv " +oper "+=" +. " " +num "1" +. ";\n\targc " +oper "-=" +. " " +num "1" +. ";\n\n\t" +kwd "while" +. " (argc" +oper "--" +. ") {\n\t\t" +func "printf" +. "(" +str "\"%s\\n\"" +oper "," +. " " +kwd "*" +. "argv" +oper "++" +. ");\n\t}\n\n\t" +kwd "return" +. " (" +num "0" +. ");\n}" \ No newline at end of file diff --git a/tests/snapshots/test.css.txt b/tests/snapshots/test.css.txt new file mode 100644 index 0000000..43724b9 --- /dev/null +++ b/tests/snapshots/test.css.txt @@ -0,0 +1,70 @@ +kwd "@import" +. " " +str "\"my-styles.css\"" +. ";\n\n" +kwd "p" +. " > " +kwd "a" +. ",\n" +var ".class" +. ",\n" +func "#id" +. " {\n\t" +var "color" +. ": " +num "blue" +. ";\n\t" +var "text-decoration" +. ": " +num "underline" +. ";\n}\n" +cmnt "/*" +err "TODO" +cmnt " comment*/" +. "\n\n" +kwd "@page" +. " " +var ":left" +. " {\n\t" +var "color" +. ": " +num "#2222" +. ";\n\t" +var "margin-left" +. ": " +num "4" +var "cm" +. ";\n\t" +var "margin-right" +. ": " +num "3" +var "cm" +. ";\n\t" +var "background" +. ": " +func "url" +. "(" +str "test.jpg" +. ")" +. ";\n\t" +var "color" +. ": " +func "rgb" +. "(" +num "5" +. ", " +num "5" +. ", " +num "5" +. ");\n}\n" +kwd "@media" +. " " +kwd "print" +. " {\n\t" +kwd "body" +. " { " +var "font-size" +. ": " +num "10" +var "pt" +. " }\n}" \ No newline at end of file diff --git a/tests/snapshots/test.csv.txt b/tests/snapshots/test.csv.txt new file mode 100644 index 0000000..02bc750 --- /dev/null +++ b/tests/snapshots/test.csv.txt @@ -0,0 +1,14 @@ +. "cars" +oper "," +str "\"chocolat, fruits\"" +oper "," +. "price\nyes" +oper "," +str "\"no," +. "\nmaybe" +str "\",x" +. "\nno" +oper "," +. "yes" +oper "," +. "y" \ No newline at end of file diff --git a/tests/snapshots/test.diff.txt b/tests/snapshots/test.diff.txt new file mode 100644 index 0000000..e1dfeff --- /dev/null +++ b/tests/snapshots/test.diff.txt @@ -0,0 +1,49 @@ +section "0a1,6" +. "\n" +insert "> This is an important" +. "\n" +insert "> notice! It should" +. "\n" +insert "> therefore be located at" +. "\n" +insert "> the beginning of this" +. "\n" +insert "> document!" +. "\n" +insert ">" +. "\n" +section "11,15d16" +. "\n" +deleted "< This paragraph contains" +. "\n" +deleted "< text that is outdated." +. "\n" +insert "+ It will be deleted in the" +. "\n" +deleted "- near future." +. "\n" +deleted "<" +. "\n" +section "17c18" +. "\n" +deleted "< check this dokument. On" +. "\n" +deleted "---" +. "\n" +insert "> check this document. On" +. "\n" +section "24a26,29" +. "\n" +insert ">" +. "\n" +insert "> This paragraph contains" +. "\n" +insert "> important new additions" +. "\n" +insert "> to this document." +. "\n" +kwd "! to this document." +. "\n\n" +section "@@ -1 +1,2 @@" +. "\n\n" +section "*** pos ***" \ No newline at end of file diff --git a/tests/snapshots/test.docker.txt b/tests/snapshots/test.docker.txt new file mode 100644 index 0000000..dcc130f --- /dev/null +++ b/tests/snapshots/test.docker.txt @@ -0,0 +1,67 @@ +cmnt "# create a dockerfile for a simple hello world app" +. "\n\n" +kwd "FROM" +. " ubuntu:" +num "14.04" +. "\n\n" +kwd "RUN" +. " apt-get " +kwd "update" +. " " +kwd "&&" +. " " +func "apt-get" +. " " +kwd "install" +kwd " -y" +. " curl\n\n" +kwd "ENV" +. " APP_NAME hello-world\n\n" +kwd "EXPOSE" +. " " +num "8080" +. "\n\n" +kwd "RUN" +. " echo " +str "\"Hello World\"" +. " " +oper ">" +. " " +oper "/usr/share/nginx/html/index.html" +. "\n\n" +kwd "ARG" +. " APP_NAME\n\n" +kwd "RUN" +. " [" +kwd " -d" +. " " +oper "/usr/share/nginx/html/" +var "$APP_NAME" +. " ] " +kwd "||" +. " " +func "mkdir" +. " " +oper "/usr/share/nginx/html/" +var "$APP_NAME" +. "\n\n" +kwd "CMD" +. " [" +str "\"/usr/sbin/nginx\"" +. ", " +str "\"-g\"" +. ", " +str "\"daemon off;\"" +. "]\n\n" +kwd "LABEL" +. " " +var "maintainer" +oper "=" +str "\"hello\"" +. "\n\n" +kwd "maintainer" +. "\n\n" +kwd "ENTRYPOINT" +. " [" +str "\"/bin/bash\"" +. "]" \ No newline at end of file diff --git a/tests/snapshots/test.git.txt b/tests/snapshots/test.git.txt new file mode 100644 index 0000000..5c79a6d --- /dev/null +++ b/tests/snapshots/test.git.txt @@ -0,0 +1,21 @@ +func "git diff" +. "\n" +kwd "commit 526" +. "\n" +deleted "--- before" +. "\n" +insert "+++ after" +. "\n" +section "@@ -1 +1,2 @@" +. "\n" +cmnt "# " +err "TODO" +cmnt " comment" +. "\n" +deleted "-hello" +. "\n" +insert "+test" +. "\n" +str "'string'" +. "\n" +str "\"string\"" \ No newline at end of file diff --git a/tests/snapshots/test.go.txt b/tests/snapshots/test.go.txt new file mode 100644 index 0000000..c68a207 --- /dev/null +++ b/tests/snapshots/test.go.txt @@ -0,0 +1,38 @@ +cmnt "// create a simple program that takes a number and prints it out\n" +kwd "package" +. " main\n\n" +cmnt "// import the fmt package\n" +kwd "import" +. " " +str "\"fmt\"" +. "\n\n" +cmnt "// main is the entry point for the program\n" +kwd "func" +. " " +func "main" +. "() {\n\t" +cmnt "// declare a variable named num and assign it the value of 10\n" +. "\tnumTest :" +oper "=" +. " " +num "10" +. "\n\n\t" +cmnt "// sanity check\n" +. "\tfmt" +oper "." +func "Println" +. "(" +str "\"num is\"" +. ", numTest)\n\n\t" +cmnt "//scan from the console and assign the value to the variable num\n" +. "\tfmt" +oper "." +func "Scanln" +. "(" +kwd "&" +. "numTest)\n\n\n\t" +cmnt "// print the value of num\n" +. "\tfmt" +oper "." +func "Println" +. "(numTest)\n}" \ No newline at end of file diff --git a/tests/snapshots/test.html.txt b/tests/snapshots/test.html.txt new file mode 100644 index 0000000..f674c9c --- /dev/null +++ b/tests/snapshots/test.html.txt @@ -0,0 +1,189 @@ +oper "" +. "\n" +oper "<" +var "html" +. " " +class "lang" +oper "=" +str "\"en\"" +oper ">" +. "\n" +oper "<" +var "head" +oper ">" +. "\n\t" +oper "<" +var "meta" +. " " +class "charset" +oper "=" +str "UTF-8\"" +oper ">" +. "\n\t" +oper "<" +var "meta" +. " " +class "http-equiv" +oper "=" +str "X-UA-Compatible" +. " " +class "checked" +. " " +class "content" +oper "=" +str "\"IE=edge\"" +oper ">" +. "\n\t" +oper "<" +var "meta" +. " " +class "name" +oper "=" +str "\"viewp\n\tort\"" +. " " +class "test" +oper "=" +str " content" +. " " +oper "=" +str " \"width=device-width, initial-scale=1.0\"" +oper ">" +. "\n\t" +oper "<" +var "title" +oper ">" +. "Document" +oper "" +. "\n\t" +oper "<" +var "style" +. " " +class "test" +. " " +oper "=" +str " 5" +. " " +oper ">" +. "\n\t\t" +kwd "test" +. " {" +var "color" +. ": " +num "#25f" +. "}\n\t\t" +var ".css" +. " {" +var "background" +. ": " +func "url" +. "(" +str "http://website.com" +. ")" +. "}\n\t\t" +func "#test" +. " {}\n\t" +oper "" +. "\n" +oper "" +. "\n" +oper "<" +var "body" +oper ">" +. "\n\t" +cmnt "" +. "\n\thtml\n\t" +var "&#test;" +. "\n\t" +var "&123;" +. "\n\t" +oper "<" +var "img" +. " " +class "id" +. " " +oper "=" +str " 'test'" +. " " +class "src" +oper "=" +str "\" alt=\"" +. "\"" +oper ">" +. "\n\t" +oper "<" +var "script" +. " " +oper ">" +. "\n\t\t" +kwd "const" +. " test " +oper "=" +. " document" +oper "." +func "querySelectorAll" +. "(" +str "`#test-" +kwd "${" +. "name" +kwd "}" +str "`" +. ")\n\t" +oper "" +. "\n\n\t" +oper "<" +var "div" +. " " +class "charset" +oper "=" +str "utf-8\\" +. " " +class "test" +oper ">" +. "\n\t" +oper "<" +var "div" +. " " +class "charset" +oper "=" +str " utf-8est" +oper ">" +. "egerg" +oper "<" +var "div" +oper ">" +oper "" +. "\n\t" +oper "<" +var "div" +. " " +class "charset" +oper "=" +str " utf-8e\"st" +oper ">" +. "dd\n" +oper "" +. "\n" +oper "" +. "\n" \ No newline at end of file diff --git a/tests/snapshots/test.http.txt b/tests/snapshots/test.http.txt new file mode 100644 index 0000000..3d5ca78 --- /dev/null +++ b/tests/snapshots/test.http.txt @@ -0,0 +1,101 @@ +section "HTTP/1.1" +. " " +num "200" +. " OK\n" +var "Date" +oper ":" +. " Mon" +oper "," +. " " +num "23" +. " May " +num "2005" +. " " +num "22" +oper ":" +num "38" +oper ":" +num "34" +. " GMT\n" +var "Content-Type" +oper ":" +. " text/html" +oper ";" +. " charset" +oper "=" +. "UTF-" +num "8" +. "\n" +var "Content-Length" +oper ":" +. " " +num "155" +. "\n" +var "Last-Modified" +oper ":" +. " Wed" +oper "," +. " " +num "08" +. " Jan " +num "2003" +. " " +num "23" +oper ":" +num "11" +oper ":" +num "55" +. " GMT\n" +var "Server" +oper ":" +. " Apache/" +num "1.3.3.7" +. " (Unix) (Red-Hat/Linux)\n" +var "ETag" +oper ":" +. " " +str "\"3f80f-1b6-3e1cb03b\"" +. "\n" +var "Accept-Ranges" +oper ":" +. " bytes\n" +var "Connection" +oper ":" +. " close" +. "\n\n" +oper "<" +var "html" +oper ">" +. "\n " +oper "<" +var "head" +oper ">" +. "\n " +oper "<" +var "title" +oper ">" +. "An Example Page" +oper "" +. "\n " +oper "" +. "\n " +oper "<" +var "body" +oper ">" +. "\n " +oper "<" +var "p" +oper ">" +. "Hello World, this is a very simple HTML document." +oper "" +. "\n " +oper "" +. "\n" \ No newline at end of file diff --git a/tests/snapshots/test.ini.txt b/tests/snapshots/test.ini.txt new file mode 100644 index 0000000..7721017 --- /dev/null +++ b/tests/snapshots/test.ini.txt @@ -0,0 +1,20 @@ +section "[section]" +. "\n" +var "a" +oper "=" +str "a" +. "\n" +var "b" +oper "=" +str "str" +. "\n" +cmnt ";[section]" +. "\n" +cmnt "\t# " +err "FIXME" +cmnt " var=a" +. "\n" +var "file" +oper "=" +str "\"str\"" +. "\n" \ No newline at end of file diff --git a/tests/snapshots/test.java.txt b/tests/snapshots/test.java.txt new file mode 100644 index 0000000..b21a67e --- /dev/null +++ b/tests/snapshots/test.java.txt @@ -0,0 +1,244 @@ +cmnt "//import the language module\n" +kwd "import" +. " java" +oper "." +. "util" +oper "." +class "Scanner" +. ";\n\n" +cmnt "//token class\n" +kwd "class" +. " " +class "Token" +. " {\n\t" +kwd "public" +. " " +class "String" +. " type;\n\t" +kwd "public" +. " " +class "String" +. " value;\n\t" +kwd "public" +. " " +kwd "int" +. " line;\n\t" +kwd "public" +. " " +kwd "int" +. " column;\n\t" +kwd "public" +. " " +func "token" +. "(" +class "String" +. " type" +oper "," +. " " +class "String" +. " value" +oper "," +. " " +kwd "int" +. " line" +oper "," +. " " +kwd "int" +. " column) {\n\t\t" +kwd "this" +oper "." +. "type " +oper "=" +. " type;\n\t\t" +kwd "this" +oper "." +. "value " +oper "=" +. " value;\n\t\t" +kwd "this" +oper "." +. "line " +oper "=" +. " line;\n\t\t" +kwd "this" +oper "." +. "column " +oper "=" +. " column;\n\t}\n}\n\n" +cmnt "//lexer function that take a string and return a list of tokens\n" +class "List" +oper "<" +class "Token" +oper ">" +. " " +func "lexer" +. "(" +class "String" +. " s) {\n\t" +class "List" +oper "<" +class "Token" +oper ">" +. " tokensList " +oper "=" +. " " +kwd "new" +. " " +class "ArrayList" +oper "<" +class "Token" +oper ">" +. "();\n\t" +kwd "int" +. " line " +oper "=" +. " " +num "1" +. ";\n\t" +kwd "int" +. " column " +oper "=" +. " " +num "0" +. ";\n\t" +kwd "int" +. " i " +oper "=" +. " " +num "0" +. ";\n\t" +kwd "while" +. " (i " +oper "<" +. " s" +oper "." +func "length" +. "()) {\n\t\t" +kwd "char" +. " c " +oper "=" +. " s" +oper "." +func "charAt" +. "(i);\n\t\t" +kwd "if" +. " (c " +oper "==" +. " " +str "'\\n'" +. ") {\n\t\t\tline" +oper "++" +. ";\n\t\t\tcolumn " +oper "=" +. " " +num "0" +. ";\n\t\t} " +kwd "else" +. " {\n\t\t\tcolumn" +oper "++" +. ";\n\t\t}\n}\n\n" +cmnt "//function that take a list of tokens and execute the program\n" +kwd "void" +. " " +func "run" +. "(" +class "List" +oper "<" +class "Token" +oper ">" +. ") {\n\t" +class "Stack" +oper "<" +class "Integer" +oper ">" +. " stack " +oper "=" +. " " +kwd "new" +. " " +class "Stack" +oper "<" +class "Integer" +oper ">" +. "();\n\t" +kwd "for" +. " (" +class "Token" +. " token " +oper ":" +. " tokens) {\n\t\t" +kwd "if" +. " (token" +oper "." +. "type " +oper "==" +. " " +str "\"NUMBER\"" +. ") {\n\t\t\tstack" +oper "." +func "push" +. "(" +class "Integer" +oper "." +func "parseInt" +. "(token" +oper "." +. "value));\n\t\t} " +kwd "else" +. " " +kwd "if" +. " (token" +oper "." +. "type " +oper "==" +. " " +str "\"ID\"" +. ") {\n\t\t\tstack" +oper "." +func "push" +. "(stack" +oper "." +func "pop" +. "() " +oper "+" +. " stack" +oper "." +func "pop" +. "());\n\t\t}\n\t}\n\t" +class "System" +oper "." +. "out" +oper "." +func "println" +. "(stack" +oper "." +func "pop" +. "());\n}\n\n" +cmnt "//main function\n" +kwd "public" +. " " +kwd "static" +. " " +kwd "void" +. " " +func "main" +. "(" +class "String" +. "[] args) {\n\t" +class "String" +. " s " +oper "=" +. " " +str "\"1+2+3\"" +. ";\n\t" +class "List" +oper "<" +class "Token" +oper ">" +. " tokensList " +oper "=" +. " " +func "lexer" +. "(s);\n\t" +func "run" +. "(tokensList);\n}\n" \ No newline at end of file diff --git a/tests/snapshots/test.js.txt b/tests/snapshots/test.js.txt new file mode 100644 index 0000000..339dc6b --- /dev/null +++ b/tests/snapshots/test.js.txt @@ -0,0 +1,203 @@ +cmnt "/* Multiline " +insert "FIX" +cmnt "\n\tComment */" +. "\n" +cmnt "/**\n* js doc " +insert "CHANGED" +cmnt " x\n* " +kwd "@param" +cmnt " " +class "{String}" +cmnt " param\n* " +kwd "@return" +cmnt " nothing\n*/" +. "\n" +kwd "const" +. " listener " +oper "=" +. " " +class "Deno" +oper "." +func "listen" +. "({ " +. "port" +oper ":" +. " " +num "8000" +. " });\nconsole" +oper "." +func "log" +. "(" +num ".8" +. " " +oper "*" +. " " +num "0." +. " " +oper "*" +. " (" +num "0.8" +. " " +oper "*" +. " " +num ".e8" +. ") " +oper "*" +. " " +num "0.e8" +. " " +oper "*" +. " " +num "0x849" +oper "," +. " " +num "0d0101" +oper "," +. " " +num "0o987" +oper "," +. " " +num "8_987_654.1789" +. ")\nconsole" +oper "?." +func "log" +. "(" +str "`http://localhost:" +kwd "${" +num "PORT" +kwd "}" +str "/`" +oper "." +func "match" +. "(" +oper "/:" +num "[0-9]" +var "{2,4}" +kwd "^" +oper "/" +kwd "g" +. "));\n" +cmnt "// " +err "TODO" +cmnt " other comment\n" +kwd "for" +. " " +kwd "await" +. " (" +kwd "const" +. " conn " +kwd "of" +. " listener) {\n\t" +kwd "if" +. " (" +bool "false" +. ")\n\t\t" +kwd "break" +. ";\n\t(" +kwd "async" +. " () " +kwd "=>" +. " {\n\t\t" +kwd "const" +. " requests " +oper "=" +. " " +class "Deno" +oper "." +func "serveHttp" +. "(conn);\n\t\t" +kwd "for" +. " " +kwd "await" +. " (" +kwd "const" +. " { respondWith } " +kwd "of" +. " " +kwd "this" +oper "." +. "requests" +oper "." +kwd "new" +. ") {\n\t\t\t" +func "respondWith" +. "(" +kwd "new" +. " " +class "Response" +. "(" +str "'Hello\\\n\t\t\t world'" +. "));\n\t\t}\n\t})();\n}\n" +kwd "function" +. " " +func "test" +. "(test) {\n\t" +kwd "let" +. " " +func "test" +. " " +oper "=" +. " () " +kwd "=>" +. " { console" +oper "." +func "log" +. "(test) };\n\t" +kwd "return" +. " test;\n}\n" +kwd "export" +. " " +kwd "default" +. " {\n\t" +. "jsonData" +oper ":" +. " a " +oper ">" +. " " +num "5" +oper "," +. "\n\t" +. "match" +oper ":" +. " " +oper "/test/" +kwd "g" +oper "," +. "\n\t" +. "type" +oper ":" +. " " +str "`test\n\t" +kwd "${" +str "'test'" +kwd "}" +str "hello\n\t" +kwd "${" +. "test " +oper "+" +. " " +num "2.5" +kwd "}" +str "hello`" +oper "," +. "\n\t" +. "'Hello world'" +oper ":" +. " " +bool "true" +. "\n}\n\n{\n\t" +. "Aw" +oper ":" +. " " +class "Class" +. "()\n\t" +. "AW" +oper ":" +. " " +num "1" +. "\n\t" +. "key" +oper ":" +. " " +str "'value1'" +. "\n}\n" \ No newline at end of file diff --git a/tests/snapshots/test.jsdoc.txt b/tests/snapshots/test.jsdoc.txt new file mode 100644 index 0000000..ca27ac5 --- /dev/null +++ b/tests/snapshots/test.jsdoc.txt @@ -0,0 +1,7 @@ +kwd "@name" +cmnt " test.js\n" +kwd "@params" +cmnt " " +class "{Number}" +cmnt " " +var "[test=null]" \ No newline at end of file diff --git a/tests/snapshots/test.json.txt b/tests/snapshots/test.json.txt new file mode 100644 index 0000000..9a401bb --- /dev/null +++ b/tests/snapshots/test.json.txt @@ -0,0 +1,59 @@ +. "{\n " +var "\"firstName\"" +. ": " +str "\"John\"" +. ",\n " +var "\"lastName\"" +. ": " +str "\"Smith\"" +. ",\n " +var "\"isAlive\"" +. ": " +bool "true" +. ",\n " +var "\"age\"" +. ": " +num "27" +. ",\n " +var "\"address\"" +. ": {\n " +var "\"streetAddress\"" +. ": " +str "\"21 2nd Street\"" +. ",\n " +var "\"city\"" +. ": " +str "\"New York\"" +. ",\n " +var "\"state\"" +. ": " +str "\"NY\"" +. ",\n " +var "\"postalCode\"" +. ": " +str "\"10021-3100\"" +. "\n },\n " +var "\"phone.numbers\"" +. ": [\n {\n " +var "\"type\"" +. ": " +str "\"home\"" +. ",\n " +var "\"number\"" +. ": " +str "\"212 555-1234\"" +. "\n },\n {\n " +var "\"type\"" +. ": " +str "\"office\"" +. ",\n " +var "\"number\"" +. ": " +str "\"646 555-4567\"" +. "\n }\n ],\n " +var "\"children\"" +. ": [],\n " +var "\"spouse\"" +. ": " +num "null" +. "\n}\n" \ No newline at end of file diff --git a/tests/snapshots/test.leanpub-md.txt b/tests/snapshots/test.leanpub-md.txt new file mode 100644 index 0000000..e72199c --- /dev/null +++ b/tests/snapshots/test.leanpub-md.txt @@ -0,0 +1,23 @@ +. "// You might see insertions\n" +insert "leanpub-start-insert" +. "\nconst webpack = require(" +str "\"webpack\"" +. ");\n" +insert "leanpub-end-insert" +. "\n\n// You might see deletions as well\n" +deleted "leanpub-start-delete" +. "\nconst { MiniHtmlWebpackPlugin } = require(" +str "\"mini-html-webpack-plugin\"" +. ");\n" +deleted "leanpub-end-delete" +. "\n\n// Or combinations of both\n" +deleted "leanpub-start-delete" +. "\nconst { MiniHtmlWebpackPlugin } = require(" +str "\"mini-html-webpack-plugin\"" +. ");\n" +deleted "leanpub-end-delete" +. "\n" +insert "leanpub-start-insert" +. "\nx = lambda a : a + 10\nprint(x(5)) \n" +insert "leanpub-end-insert" +. "\n\n// If content has been omitted, then ellipsis is used\n...\n" \ No newline at end of file diff --git a/tests/snapshots/test.log.txt b/tests/snapshots/test.log.txt new file mode 100644 index 0000000..3f0c946 --- /dev/null +++ b/tests/snapshots/test.log.txt @@ -0,0 +1,350 @@ +num "127.0.0.1" +. " user-identifier frank [" +num "10" +. "/Oct/" +num "2000" +. ":" +num "13" +. ":" +num "55" +. ":" +num "36" +. " -" +num "0700" +. "] " +str "\"GET /apache_pb.gif HTTP/1.0\"" +. " " +num "200" +. " " +num "2326" +. "\n\n" +cmnt "#Version: 1.0" +. "\n" +cmnt "#Date: 12-Jan-1996 00:00:00" +. "\n" +cmnt "#Fields: time cs-method cs-uri" +. "\n" +num "00" +. ":" +num "34" +. ":" +num "23" +. " GET /foo/bar" +oper "." +. "html\n" +num "12" +. ":" +num "21" +. ":" +num "16" +. " GET /foo/bar" +oper "." +. "html\n" +num "12" +. ":" +num "45" +. ":" +num "52" +. " GET /foo/bar" +oper "." +. "html\n" +num "12" +. ":" +num "57" +. ":" +num "34" +. " GET /foo/bar" +oper "." +. "html\n\n[" +num "2021" +. "-" +num "12" +. "-" +num "10" +. "][" +num "21" +. ":" +num "42" +. ":" +num "22" +. "][" +err "WARN" +. "][discord_dispatch::application_manager:" +num "1034" +. "] " +err "Failed" +. " to read install path" +oper "." +. " path=AbsolutePath { path_buf: " +str "\"C:\\\\Users\\\\micha\\\\AppData\\\\Local\\\\DiscordGames\"" +. " } " +err "error" +. "=Os { code: " +num "3" +oper "," +. " kind: " +err "NotFound" +oper "," +. " message: " +str "\"Das System kann den angegebenen Pfad nicht finden.\"" +. " }\n[" +num "2021" +. "-" +num "12" +. "-" +num "11" +. "][" +num "13" +. ":" +num "05" +. ":" +num "13" +. "][DEBUG][discord_dispatch::application_manager:" +num "195" +. "] App started" +oper "." +. " version=" +str "\"1.10.5\"" +. "\n\n" +num "2021" +. "-" +num "01" +. "-12T13:" +num "38" +. ":16Z containerd time=" +str "\"2021-01-12T13:38:16.338835400Z\"" +. " level=info msg=" +str "\"skip loading plugin \\\"io.containerd.snapshotter.v1.btrfs\\\"...\"" +. " " +err "error" +. "=" +str "\"path /var/lib/desktop-containerd/daemon/io.containerd.snapshotter.v1.btrfs (ext4) must be a btrfs filesystem to be used with the btrfs snapshotter: skip plugin\"" +. " type=io" +oper "." +. "containerd" +oper "." +. "snapshotter" +oper "." +. "v1\n" +num "2021" +. "-" +num "03" +. "-05T17:" +num "58" +. ":29Z kmsg (" +num "977696" +. ") - " +num "2021" +. "-" +num "03" +. "-05T17:" +num "58" +. ":" +num "28." +. "2836488Z: init: (" +num "141" +. ") " +err "ERROR" +. ": StartHostListener:" +num "356" +. ": write " +err "failed" +. " " +num "32" +. "\ntime=" +str "\"2021-01-12T14:38:11+01:00\"" +. " level=info msg=" +str "\"๐Ÿ€ socket server listening : \\\\\\\\.\\\\pipe\\\\dockerGuiToDriver\"" +. "\n\n" +err "Exception" +. " in thread " +str "\"main\"" +. " java" +oper "." +. "lang" +oper "." +err "NullPointerException" +. ": Fictitious " +err "NullPointerException" +. "\nat ClassName" +oper "." +. "methodName1(ClassName" +oper "." +. "java:lineNumber)\nat ClassName" +oper "." +. "methodName2(ClassName" +oper "." +. "java:lineNumber)\nat ClassName" +oper "." +. "methodName3(ClassName" +oper "." +. "java:lineNumber)\nat ClassName" +oper "." +. "main(ClassName" +oper "." +. "java:lineNumber)\n\n" +num "47.29.201.179" +. " - - [" +num "28" +. "/Feb/" +num "2021" +. ":" +num "13" +. ":" +num "17" +. ":" +num "10" +. " +" +num "0000" +. "] " +str "\"GET /?p=1 HTTP/2.0\"" +. " " +num "200" +. " " +num "5316" +. " " +str "\"https://domain1.com/?p=1\"" +. " " +str "\"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36\"" +. " " +str "\"2.75\"" +. "\nMar " +num "19" +. " " +num "22" +. ":" +num "10" +. ":" +num "24" +. " xxxxxxx journal: xxxxxxxx" +oper "." +. "mylabserver" +oper "." +. "com nginx: photos" +oper "." +. "example" +oper "." +. "com " +num "127.0.0.1" +. " - - [" +num "19" +. "/Mar/" +num "2018" +. ":" +num "22" +. ":" +num "10" +. ":" +num "24" +. " +" +num "0000" +. "] " +str "\"GET / HTTP/1.1\"" +. " " +num "200" +. " " +num "53324" +. " " +str "\"-\"" +. " " +str "\"curl/7.29.0\"" +. " " +str "\"-\"" +. "\nTLSv1" +num ".2" +. " AES128-SHA " +num "1.1.1.1" +. " " +str "\"Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0\"" +. "\n\n" +num "4" +. "/" +num "1" +. "/" +num "2021" +. " " +num "14" +. ":" +num "15" +. ":" +num "27" +. " - PFRO " +err "Error" +. ": \\??\\C:\\Windows\\system32\\spool\\DRIVERS\\x64\\" +num "3" +. "\\New\\FXSAPI" +oper "." +. "DLL" +oper "," +. " \\??\\C:\\Windows\\system32\\spool\\DRIVERS\\x64\\" +num "3" +. "\\FXSAPI" +oper "." +. "DLL" +oper "," +. " " +num "0xc000003a" +. "\nAudMig: Device Ids match - {" +num "5" +. "}" +oper "." +. "\\?hdaudio#func_03&ven_40de&dev_0083&subsys_50de130f&rev_4003#" +num "1" +. "&" +num "13efefe3" +. "&" +num "0" +. "&" +num "0004" +. "#{" +num "6993ad03" +. "-" +num "95ef" +. "-" +num "33d0" +. "-a2cc-" +num "00a0c9322596" +. "} opo04/" +num "00040002" +. " {" +num "2" +. "}" +oper "." +. "\\?hdaudio#func_01&ven_40de&dev_0084&subsys_10de310f&rev_1004#" +num "2" +. "&" +num "22efefe2" +. "&" +num "0" +. "&" +num "0004" +. "#{" +num "6994ad04" +. "-" +num "94ef" +. "-" +num "32d0" +. "-a1cc-" +num "00a0c9181396" +. "} opo04/" +num "00030001" +. "\nAudMig: Migrated {a31c434e-df4c-" +num "1efd" +. "-" +num "8010" +. "-" +num "67d416a840e0" +. "}" +oper "," +num "2" +. " property at " +num "3" +. "\n\n[" +num "07" +. ":" +num "28" +. ":" +num "21" +. "] [Server thread/INFO] [FML]: " +err "Invalid" +. " recipe found with multiple oredict ingredients in the same ingred" \ No newline at end of file diff --git a/tests/snapshots/test.lua.txt b/tests/snapshots/test.lua.txt new file mode 100644 index 0000000..b0720ed --- /dev/null +++ b/tests/snapshots/test.lua.txt @@ -0,0 +1,197 @@ +cmnt "#!/bin/lua" +. "\n\n" +cmnt "--[=[\n\tThis is also a block comment\n\tWe can include \"]]\" inside this comment\n--]=]" +. "\n\n" +cmnt "--[==[\n\tThis is also a block comment\n\tWe can include \"]=]\" inside this comment\nf --]==]" +. "\n\nvf " +cmnt "--tst" +. "\n\na " +oper "=" +. " " +str "'alo\\n123\"'" +. "\na " +oper "=" +. " " +str "\"alo\\n123\\\"\"" +. "\na " +oper "=" +. " " +str "'\\97lo\\10\\04923\"'" +. "\na " +oper "=" +. " [[alo\n" +num "123" +str "\"]]" +. "\na " +oper "=" +. " [" +oper "==" +. "[\nalo\n" +num "123" +str "\"]==]" +. "\n\nvar " +oper "::=" +. " prefixexp `[ยด exp `]ยด\n\nstat " +oper "::=" +. " " +kwd "while" +. " exp " +kwd "do" +. " block " +kwd "end" +. "\nstat " +oper "::=" +. " " +kwd "repeat" +. " block " +kwd "until" +. " exp\nstat " +oper "::=" +. " " +kwd "if" +. " exp " +kwd "then" +. " " +func "block" +. " {" +kwd "elseif" +. " exp " +kwd "then" +. " block} [" +kwd "else" +. " block] " +kwd "end" +. "\n\n" +kwd "do" +. "\n\t" +kwd "local" +. " f" +oper "," +. " s" +oper "," +. " var " +oper "=" +. " explist\n\t" +kwd "while" +. " " +bool "true" +. " " +kwd "do" +. "\n\t\t" +kwd "local" +. " var_1" +oper "," +. " ยทยทยท" +oper "," +. " var_n " +oper "=" +. " " +func "f" +. "(s" +oper "," +. " var)\n\t\tvar " +oper "=" +. " var_1\n\t\t" +kwd "if" +. " var " +oper "==" +. " " +bool "nil" +. " " +kwd "then" +. " " +kwd "break" +. " " +kwd "end" +. "\n\t\tblock\n\t" +kwd "end" +. "\n" +kwd "end" +. "\n\n" +kwd "do" +. "\n\t" +kwd "local" +. " t " +oper "=" +. " {}\n\tt[" +func "f" +. "(" +num "1" +. ")] " +oper "=" +. " g\n\tt[" +num "1" +. "] " +oper "=" +. " " +str "\"x\"" +. " " +cmnt "-- 1st exp" +. "\n\tt[" +num "2" +. "] " +oper "=" +. " " +str "\"y\"" +. " " +cmnt "-- 2nd exp" +. "\n\tt" +oper "." +. "x " +oper "=" +. " " +num "1" +. " " +cmnt "-- t[\"x\"] = 1" +. "\n\tt[" +num "3" +. "] " +oper "=" +. " " +func "f" +. "(x) " +cmnt "-- 3rd exp" +. "\n\tt[" +num "30" +. "] " +oper "=" +. " " +num "23" +. "\n\tt[" +num "4" +. "] " +oper "=" +. " " +num "45" +. " " +cmnt "-- 4th exp" +. "\n\ta " +oper "=" +. " t\n" +kwd "end" +. "\n\n" +kwd "function" +. " " +func "max" +. "(num1" +oper "," +. " num2)\n\n\t" +kwd "if" +. " (num1 " +oper ">" +. " num2) " +kwd "then" +. "\n\t\t result " +oper "=" +. " num1;\n\t" +kwd "else" +. "\n\t\t result " +oper "=" +. " num2;\n\t" +kwd "end" +. "\n\n\t" +kwd "return" +. " result;\n" +kwd "end" +. "\n" +cmnt "--]=]" \ No newline at end of file diff --git a/tests/snapshots/test.make.txt b/tests/snapshots/test.make.txt new file mode 100644 index 0000000..0facc92 --- /dev/null +++ b/tests/snapshots/test.make.txt @@ -0,0 +1,138 @@ +var "PACKAGE" +. "\t = package\n" +var "VERSION" +. "\t = ` date " +str "\"+%Y.%m%d%\"" +. " `\n" +var "RELEASE_DIR" +. " = ..\n" +var "RELEASE_FILE" +. " = " +oper "$(" +. "PACKAGE" +oper ")" +. "-" +oper "$(" +. "VERSION" +oper ")" +. "\n" +cmnt "\n# that won't understand these lines" +. "\n" +kwd "ifneq" +. " " +oper "(" +. "," +oper ")" +. "\n" +func "This" +. " makefile requires GNU Make." +. "\n" +kwd "endif" +. "\n" +cmnt "\n# Notice that the variable LOGNAME comes from the environment in" +. "\n" +cmnt "# POSIX shells." +. "\n" +cmnt "#" +. "\n" +cmnt "# target: all - Default target. Does nothing." +. "\n" +section "all:" +. "\n" +. "\t" +func "echo" +. " " +str "\"Hello " +var "$(LOGNAME)" +str ", nothing to do by default\"" +. "\n" +cmnt "\t\t# " +err "TODO" +cmnt " sometimes: echo \"Hello ${LOGNAME}, nothing to do by default\"" +. "\n" +. "\t" +func "echo" +. " " +str "\"Try 'make help'\"" +. "\n" +cmnt "\n# target: help - Display callable targets." +. "\n" +section "help:" +. "\n" +. "\t" +func "egrep" +. " " +str "\"^# target:\"" +. " [Mm]akefile" +. "\n" +cmnt "\n# target: list - List source files" +. "\n" +section "list:" +. "\n" +cmnt "\t# Won't work. Each command is in separate shell" +. "\n" +. "\t@cd src" +. "\n" +. "\t" +func "ls" +. "\n" +cmnt "\n\t# Correct, continuation of the same shell" +. "\n" +. "\t" +func "cd" +. " src" +kwd ";" +. " \\" +. "\n" +. "\t" +func "ls" +. "\n" +cmnt "\n# target: dist - Make a release." +. "\n" +section "dist:" +. "\n" +. "\t" +func "tar" +kwd " -cf" +. " " +var "$(RELEASE_DIR)" +. "/" +var "$(RELEASE_FILE)" +. " " +kwd "&&" +. " \\" +. "\n" +. "\t" +func "gzip" +. " -" +num "9" +. " " +var "$(RELEASE_DIR)" +. "/" +var "$(RELEASE_FILE)" +. ".tar" +. "\n\n%.txt : %.html\n\tlynx -dump " +oper "$" +. "< > " +oper "$" +. "@\n" +cmnt "\n\n# This is an explicit suffix rule. It may be omitted on systems" +. "\n" +cmnt "# that handle simple rules like this automatically." +. "\n" +section ".c.o:" +. "\n" +. "\t" +var "$(CC)" +. " " +var "$(CFLAGS)" +kwd " -c" +. " $" +oper "<" +. "\n\n" +section "FRC:" +. "\n" +section ".SUFFIXES:" +. " .c\n\n" +class ".PHONY:" +. " clean depend\n" \ No newline at end of file diff --git a/tests/snapshots/test.md.txt b/tests/snapshots/test.md.txt new file mode 100644 index 0000000..92c93e3 --- /dev/null +++ b/tests/snapshots/test.md.txt @@ -0,0 +1,137 @@ +. "Heading\n" +cmnt "=======" +. "\n\nSub-heading\n" +cmnt "-----------" +. "\n\nParagraphs are separated\nby a blank line.\n\nTwo spaces at the end of a line\nproduce a line break.\n\n Text attributes " +kwd "_italic_" +. ",\n" +class "**bold**" +. ", " +str "`monospace`" +. ". Some " +str "`console.log(lst.filter(e => e == true))`" +. " implementations may use " +kwd "*single-asterisks*" +. " for italic text.\n\nHorizontal rule:\n\n" +cmnt "---" +. "\n\n" +kwd "```" +. "\n\n\n" +kwd "```" +. "\n\n" +kwd "```js" +. "\n" +kwd "for" +. " (" +kwd "let" +. " y " +oper "=" +. " " +num "0" +. "; y " +oper "<=" +. " size; y" +oper "++" +. ") {\n console" +oper "." +func "log" +. "(state" +oper "." +func "map" +. "(star " +kwd "=>" +. " (star " +oper "?" +. " " +. "'*'" +. " " +oper ":" +. " " +str "' '" +. "))" +oper "." +func "join" +. "(" +str "''" +. "));\n state " +oper "=" +. " state" +oper "." +func "map" +. "((_" +oper "," +. " i" +oper "," +. " arr) " +kwd "=>" +. " arr[i " +oper "+" +. " " +num "1" +. "] " +oper "||" +. " arr[i " +oper "-" +. " " +num "1" +. "]);\n}\n" +kwd "```" +. "\n\n" +kwd "```beurihiuerh" +. "\n}\n" +kwd "```" +. "\n\nStrikethrough:\n" +var "~~strikethrough~~" +. "\n\nBullet list:\n" +kwd "\n * " +. "apples\n" +kwd " * " +. "oranges\n" +kwd " * " +. "pears\n\nNumbered list:\n" +kwd "\n 1. " +. "lather\n" +kwd " 2. " +. "rinse\n" +kwd " 3. " +. "repeat\n\nAn " +oper "[example]" +func "(http://example.com)" +. ". " +func "" +. "\n\n!" +oper "[Image]" +func "(Icon-pictures.png \"icon\")" +. "\n\n" +cmnt "> Markdown uses email-style" +. "\n" +cmnt "> characters for blockquoting." +. "\n" +cmnt "> Multiple paragraphs need to be prepended individually." +. "\n\n| Item | Price | # In stock |\n|" +cmnt "--------------" +. "|" +cmnt "-----------" +. "|" +cmnt "------------" +. "|\n| Juicy Apples | 1.99 | " +kwd "*7*" +. " |\n| Bananas | " +class "**1.89**" +. " | 5234 |\n\nInline code (should start here: " +str "`await session.close()`" +. ") ended here [12][6]\n\nAnother inline code: " +str "`any`" +. "\n\nThis is a function_name. Another_One.\n\nSame for__double under__scores __ **\n\nWithin a word" +kwd "*italic*" +. "should written like this.\n\nAnd the" +class "**bold**" +. "like this.\n\n*test * *test * " +kwd "_test _ _ test_" +. "\n_ test_ _test _" \ No newline at end of file diff --git a/tests/snapshots/test.pl.txt b/tests/snapshots/test.pl.txt new file mode 100644 index 0000000..b653c5e --- /dev/null +++ b/tests/snapshots/test.pl.txt @@ -0,0 +1,55 @@ +cmnt "#!/usr/bin/perl" +. "\n\n" +kwd "use" +. " strict;\n" +kwd "use" +. " warnings;\n\n" +cmnt "# This would print with a line break in the middle" +. "\n" +kwd "print" +. " " +str "\"Hello\n\t\t\tworld\\n\"" +. ";\n$a " +oper "=" +. " " +num "10" +. ";\n" +kwd "print" +. " " +str "\"Value of a = $a\\n\"" +. ";\n\n$var " +oper "=" +. " " +oper "<<" +str "'EOF'" +. ";\n\n" +kwd "my" +. " ( $remaining" +oper "," +. " $total );\n\n$remaining " +oper "=" +. " $total " +oper "=" +. " " +func "shift" +. "(@ARGV);\n\nSTDOUT" +oper "->" +func "autoflush" +. "(" +num "1" +. ");\n\n" +kwd "while" +. " ( $remaining ) {\n\t" +func "printf" +. " ( " +str "\"Remaining %s/%s \\r\"" +oper "," +. " $remaining" +oper "--," +. " $total );\n\tsleep " +num "1" +. ";\n}\n\n" +kwd "print" +. " " +str "\"\\n\"" +. ";" \ No newline at end of file diff --git a/tests/snapshots/test.plain.txt b/tests/snapshots/test.plain.txt new file mode 100644 index 0000000..ece0276 --- /dev/null +++ b/tests/snapshots/test.plain.txt @@ -0,0 +1,7 @@ +. "In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects (floating-point numbers, images, etc.).\nIt may also include a limited number of " +str "\"whitespace\"" +. " characters that affect simple arrangement of text, such as spaces, line breaks, or tabulation characters (although tab characters can " +str "\"mean\"" +. " many different things, so are hardly " +str "\"plain\"" +. ").\nPlain text is different from formatted text, where style information is included; from structured text, where structural parts of the document such as paragraphs, sections, and the like are identified; and from binary files in which some portions must be interpreted as binary objects (encoded integers, real numbers, images, etc.)." \ No newline at end of file diff --git a/tests/snapshots/test.py.txt b/tests/snapshots/test.py.txt new file mode 100644 index 0000000..d4ed9d3 --- /dev/null +++ b/tests/snapshots/test.py.txt @@ -0,0 +1,144 @@ +cmnt "#This is a comment" +. "\n" +cmnt "# written in" +. "\n" +cmnt "#more than just one line" +. "\n\n" +cmnt "\"\"\"\nThis is a comment\nwritten in\nmore than just one line\n\"\"\"" +. "\n" +kwd "def" +. " " +func "fib" +. "(n):\n\t\ta" +oper "," +. " b " +oper "=" +. " " +num "0" +oper "," +. " " +num "1" +. "\n\t\t" +kwd "while" +. " a " +oper "<" +. " n:\n\t\t\t\t" +func "print" +. "(a" +oper "," +. " end" +oper "=" +str "' '" +. ")\n\t\t\t\ta" +oper "," +. " b " +oper "=" +. " b" +oper "," +. " a" +oper "+" +. "b\n\t\t" +func "print" +. "()\n" +func "fib" +. "(" +num "1000" +. ")\n" +func "Test" +. "(" +num "32" +. ")\n" +func "TEST" +. "(" +num "42" +. ")\nnumbers " +oper "=" +. " [" +num "2" +oper "," +. " " +num "4" +oper "," +. " " +num "6" +oper "," +. " " +num "8" +. "]\n" +cmnt "\"\"\"\nThis is a comment\nwritten in\nmore than just one line\n\"\"\"" +. "\n\n\n\n\n\n\n\n\n" +kwd "class" +. " " +class "MyClass" +. ":\n\t" +kwd "def" +. " " +func "__init__" +. "():\n \t\tx " +oper "=" +. " " +num "5" +. "\n\t\tx " +oper "=" +. " " +str "\"%1 test\"" +. " " +oper "%" +. " name\n\t\tx " +oper "=" +. " " +str "f\"test" +var "{" +. "x " +oper ">" +. " " +num "5" +var "}" +str " t est\\n " +var "{" +. "numbers" +var "}" +str " {{" +var "{" +. "test" +var "}" +str "}}\"" +. "\n\t\tx " +oper "=" +. " " +str "F\"test" +var "{" +. "x " +oper ">" +. " " +num "5" +var "}" +str " test\\n " +var "{" +. "numbers" +var "}" +str " {{\\" +var "{" +. "test" +var "}" +str "}}\\\" test" +. "\n\nx " +oper "=" +. " " +kwd "lambda" +. " a : a " +oper "+" +. " " +num "10" +. "\n\nres " +oper "=" +. " await dst_conn." +func "executemany" +. "(" +str "f\"\"\"\n\tSynced " +var "{" +. "synced" +var "}" +str ".\n\"\"\"" +oper "," +. " to_upsert)\n" \ No newline at end of file diff --git a/tests/snapshots/test.regex.txt b/tests/snapshots/test.regex.txt new file mode 100644 index 0000000..1d560ee --- /dev/null +++ b/tests/snapshots/test.regex.txt @@ -0,0 +1,11 @@ +oper "/(" +num "[A-Z]" +oper ")" +kwd "\\w" +var "+" +kwd "\\d" +var "{0,9}" +oper "/" +kwd "gi\n" +err "TODO" +cmnt " comment" \ No newline at end of file diff --git a/tests/snapshots/test.rs.txt b/tests/snapshots/test.rs.txt new file mode 100644 index 0000000..35695bc --- /dev/null +++ b/tests/snapshots/test.rs.txt @@ -0,0 +1,143 @@ +cmnt "/*\n\tcreate a simple multithreaded server\n*/" +. "\n\n" +cmnt "//include the library\n" +kwd "use" +. " std" +oper "::" +. "net" +oper "::" +. "{" +class "TcpListener" +oper "," +. " " +class "TcpStream" +. "};\n" +kwd "use" +. " std" +oper "::" +. "io" +oper "::" +. "{" +class "Read" +oper "," +. " " +class "Write" +. "};\n" +kwd "use" +. " std" +oper "::" +. "thread;\n\n" +cmnt "//function that handles the client\n" +kwd "fn" +. " " +func "handle_client" +. "(" +kwd "mut" +. " stream" +oper ":" +. " " +class "TcpStream" +. ") {\n\t" +cmnt "//read the message\n" +. "\t" +kwd "let" +. " " +kwd "mut" +. " buffer " +oper "=" +. " [" +num "0" +. "; " +num "512" +. "];\n\tstream" +oper "." +func "read" +. "(" +oper "&" +kwd "mut" +. " buffer)" +oper "." +func "unwrap" +. "();\n\t" +cmnt "//print the message\n" +. "\t" +func "println" +oper "!" +. "(" +str "\"{}\"" +oper "," +. " " +class "String" +oper "::" +func "from_utf8_lossy" +. "(" +oper "&" +. "buffer[" +oper ".." +. "]));\n\t" +cmnt "//write the message back\n" +. "\tstream" +oper "." +func "write" +. "(" +oper "&" +. "buffer)" +oper "." +func "unwrap" +. "();\n}\n\n" +cmnt "//main function\n" +kwd "fn" +. " " +func "main" +. "() {\n\t" +cmnt "//create a listener\n" +. "\t" +kwd "let" +. " listener " +oper "=" +. " " +class "TcpListener" +oper "::" +func "bind" +. "(" +str "\"127.0.0.1:8080\"" +. ")" +oper "." +func "unwrap" +. "();\n\t" +cmnt "//listen for connections\n" +. "\t" +kwd "for" +. " stream " +kwd "in" +. " listener" +oper "." +func "incoming" +. "() {\n\t\t" +cmnt "//handle the connection\n" +. "\t\t" +kwd "match" +. " stream {\n\t\t\t" +class "Ok" +. "(stream) " +oper "=>" +. " {\n\t\t\t\tthread" +oper "::" +func "spawn" +. "(" +kwd "move" +. " " +oper "||" +. " {\n\t\t\t\t\t" +func "handle_client" +. "(stream);\n\t\t\t\t});\n\t\t\t}\n\t\t\t" +class "Err" +. "(e) " +oper "=>" +. " {\n\t\t\t\t" +func "println" +oper "!" +. "(" +str "\"Error: {}\"" +oper "," +. " e);\n\t\t\t}\n\t\t}\n\t}" \ No newline at end of file diff --git a/tests/snapshots/test.sql.txt b/tests/snapshots/test.sql.txt new file mode 100644 index 0000000..bf89aa9 --- /dev/null +++ b/tests/snapshots/test.sql.txt @@ -0,0 +1,36 @@ +cmnt "-- Comment\n" +kwd "SELECT" +. " " +str "'Geeks'" +. " " +oper "||" +. " " +str "' '" +. " " +oper "||" +. " " +var "@test_hello" +. " " +kwd "FROM" +. " dual;\n" +kwd "INSERT" +. " " +kwd "INTO" +. " database (geek_id, geek_name) " +kwd "VALUES" +. " (" +num "5000" +. ", " +str "'abc'" +. ");\n" +kwd "REPLACE" +. "(" +str "'123geeks123'" +. ", " +str "'123'" +. ", " +bool "TRUE" +. ");\n" +cmnt "/* " +err "FIXME" +cmnt " Multiline\n\tComment */" \ No newline at end of file diff --git a/tests/snapshots/test.todo.txt b/tests/snapshots/test.todo.txt new file mode 100644 index 0000000..64cad4c --- /dev/null +++ b/tests/snapshots/test.todo.txt @@ -0,0 +1,24 @@ +err "TODO" +cmnt " ...\n" +err "FIXME" +cmnt " ...\n" +insert "CHANGED" +cmnt " ...\n" +insert "CHANGE" +cmnt " ...\n" +insert "FIX" +cmnt " ...\n" +err "XXX" +cmnt " ...\n" +class "IDEA" +cmnt " ...\nHACK ...\nNOTE ...\nREVIEW ...\nNB ...\n" +err "BUG" +cmnt " ...\n" +oper "QUESTION" +cmnt " ...\nCOMBAK ...\nTEMP ...\n" +err "DEBUG" +cmnt " ...\n" +err "OPTIMIZE" +cmnt " ...\n" +err "WARNING" +cmnt " ..." \ No newline at end of file diff --git a/tests/snapshots/test.toml.txt b/tests/snapshots/test.toml.txt new file mode 100644 index 0000000..d3c6f18 --- /dev/null +++ b/tests/snapshots/test.toml.txt @@ -0,0 +1,79 @@ +cmnt "# " +insert "CHANGED" +cmnt " This is a TOML document" +. "\n\n" +var "title" +. " " +oper "=" +. " " +str "\"TOML Example\"" +. "\n\n" +section "[owner]" +. "\n" +var "name" +. " " +oper "=" +. " " +str "\"Tom Preston-Werner\"" +. "\n" +var "dob" +. " " +oper "=" +. " " +num "1979-05-27T07:32:00-08:00" +. "\n\n" +section "[database]" +. "\n" +var "enabled" +. " " +oper "=" +. " " +bool "true" +. "\n" +var "ports" +. " " +oper "=" +. " [ " +num "8000" +oper "," +. " " +num "inf" +oper "," +. " " +num "8002" +. " ]\n" +var "data" +. " " +oper "=" +. " [ [" +str "\"delta\"" +oper "," +. " " +str "\"phi\"" +. "]" +oper "," +. " [" +num "3.14" +. "] ]\n" +var "temp_targets" +. " " +oper "=" +. " { " +var "cpu" +. " " +oper "=" +. " " +num "79.5" +oper "," +. " " +var "case" +. " " +oper "=" +. " " +num "72.0" +. " }\n" +var "re" +. " " +oper "=" +. " " +str "\"\"\"\ntest\n\"\"\"" \ No newline at end of file diff --git a/tests/snapshots/test.ts.txt b/tests/snapshots/test.ts.txt new file mode 100644 index 0000000..56ec118 --- /dev/null +++ b/tests/snapshots/test.ts.txt @@ -0,0 +1,190 @@ +kwd "type" +. " " +class "Result" +. " " +oper "=" +. " " +str "\"pass\"" +. " " +oper "|" +. " " +str "\"fail\"" +. "\n\n" +kwd "interface" +. " " +class "User" +. " {\n\t" +. "id" +type ": number" +. "\n\t" +. "firstName" +type ": string" +. "\n\t" +. "lastName" +type ": string" +. "\n\t" +. "role" +type ": string" +. "\n\t" +. "result" +oper ":" +. " " +class "Result" +. "\n}\n\n" +kwd "const" +. " test " +oper "=" +. " {\n\t" +. "test" +oper ":" +. " value\n};\n\n" +kwd "function" +. " " +func "updateUser" +. "(" +. "id" +type ": number" +oper "," +. " " +. "update" +oper ":" +. " " +class "Partial" +oper "<" +class "User" +oper ">" +. ") {\n" +kwd "const" +. " user " +oper "=" +. " " +func "getUser" +. "(id)\n" +kwd "const" +. " newUser " +oper "=" +. " { " +oper "..." +. "user" +oper "," +. " " +oper "..." +. "update }\n" +func "saveUser" +. "(id" +oper "," +. " newUser)\n}\n\n" +kwd "function" +. " " +func "compact" +. "(" +. "arr" +type ": string" +. "[]) {\n\t" +kwd "if" +. " (arr" +oper "." +. "length " +oper ">" +. " " +num "10" +. ")\n\t\t" +kwd "return" +. " arr" +oper "." +func "slice" +. "(" +num "0" +oper "," +. " " +num "10" +. ")\n\t" +kwd "return" +. " arr\n}\n\n" +kwd "namespace" +. " " +class "Validation" +. " {\n\t" +kwd "export" +. " " +kwd "interface" +. " " +class "StringValidator" +. " {\n\t\t" +func "isAcceptable" +. "(" +. "s" +type ": string" +. ")" +type ": boolean" +. ";\n\t}\n\t" +kwd "const" +. " lettersRegexp " +oper "=" +. " " +oper "/" +kwd "^" +num "[A-Za-z]" +var "+" +kwd "$" +oper "/" +. ";\n\t" +kwd "const" +. " numberRegexp " +oper "=" +. " " +oper "/" +kwd "^" +num "[0-9]" +var "+" +kwd "$" +oper "/" +. ";\n\t" +kwd "export" +. " " +kwd "class" +. " " +class "LettersOnlyValidator" +. " " +kwd "implements" +. " " +class "StringValidator" +. " {\n\t\t" +func "isAcceptable" +. "(" +. "s" +type ": string" +. ") {\n\t\t\t" +kwd "return" +. " lettersRegexp" +oper "." +func "test" +. "(s);\n\t\t}\n\t}\n\t" +kwd "export" +. " " +kwd "class" +. " " +class "ZipCodeValidator" +. " " +kwd "implements" +. " " +class "StringValidator" +. " {\n\t\t" +func "isAcceptable" +. "(" +. "s" +type ": string" +. ") {\n\t\t\t" +kwd "return" +. " s" +oper "." +. "length " +oper "===" +. " " +num "5" +. " " +oper "&&" +. " numberRegexp" +oper "." +func "test" +. "(s);\n\t\t}\n\t}\n}" \ No newline at end of file diff --git a/tests/snapshots/test.uri.txt b/tests/snapshots/test.uri.txt new file mode 100644 index 0000000..f01e521 --- /dev/null +++ b/tests/snapshots/test.uri.txt @@ -0,0 +1,89 @@ +class "https" +oper ":" +oper "/" +oper "/" +func "john.doe@" +var "www.example.com" +num ":123" +oper "/" +. "forum" +oper "/" +. "questions" +oper "/" +oper "?" +oper "tag=" +. "networking" +oper "&" +oper "order=" +. "newest" +func "#top" +. "\n" +cmnt "# " +err "TODO" +cmnt " more uri" +. "\n" +class "http" +oper ":" +oper "/" +oper "/" +var "github.matubu.com" +oper "/" +. "shj" +oper "/" +. "examples" +oper "/" +var "index.html" +. "\n" +class "ldap" +oper ":" +oper "/" +oper "/" +. "[2001" +oper ":" +. "db8" +oper ":" +num ":7" +. "]" +oper "/" +oper "c=" +. "GB" +oper "?" +. "objectClass" +oper "?" +. "one\n" +class "mailto" +oper ":" +func "John.Doe@" +var "example.com" +. "\n" +class "news" +oper ":" +var "comp.infosystems.www.servers.unix" +. "\n" +class "tel" +oper ":" +. "+1-816-555-1212\n" +class "telnet" +oper ":" +oper "/" +oper "/" +var "192.0.2.16" +num ":80" +oper "/" +. "\n" +class "urn" +oper ":" +. "oasis" +oper ":" +. "names" +oper ":" +. "specification" +oper ":" +. "docbook" +oper ":" +. "dtd" +oper ":" +. "xml" +num ":4" +. "." +var "1.2" \ No newline at end of file diff --git a/tests/snapshots/test.xml.txt b/tests/snapshots/test.xml.txt new file mode 100644 index 0000000..ec84c97 --- /dev/null +++ b/tests/snapshots/test.xml.txt @@ -0,0 +1,278 @@ +oper "" +. "\n" +cmnt "" +. "\n" +oper "<" +var "breakfast:menu" +oper ">" +. "\n" +oper "<" +var "food" +. " " +class "test" +. " " +class "test" +oper "=" +str "\"A\"" +oper ">" +. "\n\t" +oper "<" +var "name" +oper ">" +. "Belgian Waffles" +oper "" +. "\n\t" +oper "<" +var "price" +oper ">" +. "$5.95" +oper "" +. "\n\t" +oper "<" +var "description" +oper ">" +. "\n\tTwo of our famous Belgian Waffles with plenty of real maple syrup\n\t" +oper "" +. "\n\t" +oper "<" +var "calories" +oper ">" +. "650" +oper "" +. "\n" +oper "" +. "\n" +oper "" +. "\n\n" +oper "<" +var "article" +. " " +class "xmlns:xlink" +oper "=" +str "\"http://www.w3.org/1999/xlink\"" +. " " +class "xmlns:oasis" +oper "=" +str "\"http://www.niso.org/standards/z39-96/ns/oasis-exchange/table\"" +. " " +class "xmlns:mml" +oper "=" +str "\"http://www.w3.org/1998/Math/MathML\"" +. " " +class "xmlns:ali" +oper "=" +str "\"http://www.niso.org/schemas/ali/1.0/\"" +. " " +class "xmlns:xsi" +oper "=" +str "\"http://www.w3.org/2001/XMLSchema-instance\"" +. " " +class "article-type" +oper "=" +str "\"research-article\"" +. " " +class "xml:lang" +oper "=" +str "\"en\"" +. " " +class "dtd-version" +oper "=" +str "\"1.2\"" +oper ">" +. "\n\n " +oper "<" +var "inline-graphic" +. " " +class "xlink:href" +oper "=" +str "\"filename.png\"" +oper "/>" +. "\n\n " +oper "<" +var "mml:math" +oper ">" +. "\n " +oper "<" +var "mml:mn" +oper ">" +. "4" +oper "" +. "\n " +oper "<" +var "mml:mo" +oper ">" +var "≤" +oper "" +. "\n " +oper "<" +var "mml:mi" +oper ">" +. "x" +oper "" +. "\n " +oper "<" +var "mml:mo" +oper ">" +var "<" +oper "" +. "\n " +oper "<" +var "mml:mn" +oper ">" +. "10" +oper "" +. "\n " +oper "<" +var "mml:mrow" +oper ">" +. "\n " +oper "<" +var "mml:mtext" +oper ">" +. "\"" +var " " +oper "" +. "\n " +oper "" +. "\n " +oper "" +. "\n\n " +oper "" +. "\n\n " +oper "<" +var "p" +. " " +class "content-type" +oper "=" +str "\"example\"" +oper ">" +. "This element and attribute is here to show that speed-highlight is running." +oper "" +. "\n\n" +oper "" +. "\n\n" +oper "" +. "\n" +oper "<" +var "test" +. " " +class "test" +oper "=" +str "\"b\"" +. " " +oper "/>" +. "\n" +oper "" +. "\n" +oper "" +. "\n" +oper "" +. "\n" +oper "" +. "\n" +oper "" +. "\n" +oper "" +. "\n" \ No newline at end of file diff --git a/tests/snapshots/test.yaml.txt b/tests/snapshots/test.yaml.txt new file mode 100644 index 0000000..fc65a39 --- /dev/null +++ b/tests/snapshots/test.yaml.txt @@ -0,0 +1,64 @@ +oper "-" +oper "-" +oper "-" +. " " +cmnt "# The Smiths" +. "\n" +oper "-" +. " {" +var "name" +oper ":" +. " John Smith, " +var "age" +oper ":" +. " " +num "33" +. "}\n" +oper "-" +. " " +var "name" +oper ":" +. " Mary Smith\n\t" +var "age" +oper ":" +. " " +type "!!str" +. " " +num "27" +. "\n" +oper "-" +. " [name, age]" +oper ":" +. " [Rae Smith, " +num "4" +. "] " +cmnt "# sequences as kwds are supported" +. "\n" +oper "-" +oper "-" +oper "-" +. " " +cmnt "# " +err "TODO" +cmnt " People, by gender" +. "\n" +var "men" +oper ":" +. " [" +str "\"John Smith\"" +. ", " +str "'Bill Jones'" +. ", " +bool "Yes" +. "]\n" +var "data" +oper ":" +. " " +str ">\n\tWrapped text\n\twill be folded\n\tinto a single\n\tparagraph\n\n\tBlank lines denote\n \tparagraph breaks\n" +var "women" +oper ":" +. "\n\t" +oper "-" +. " Mary Smith\n\t" +oper "-" +. " Susan Williams" \ No newline at end of file