on master help sign in
add new syntax test files
commit591eba66a3af1c211a09eefd17cbeb819b0a131f authorhenil <dedaniahenil@gmail.com> dateSun 15 Nov 2020, 00:22 (6 years ago) parenta5a9ac8
18 files changed+646
tests/syntax-tests/highlighted/ASP/test.asp+36 tests/syntax-tests/highlighted/AppleScript/test.applescript+25 tests/syntax-tests/highlighted/Fish/test.fish+77 tests/syntax-tests/highlighted/Objective-C++/test.mm+68 tests/syntax-tests/highlighted/Objective-C/test.m+32 tests/syntax-tests/highlighted/Regular Expression/test.re+1 tests/syntax-tests/highlighted/Ruby On Rails/test.rb+22 tests/syntax-tests/highlighted/Tcl/test.tcl+22 tests/syntax-tests/highlighted/Textile/test.textile+40 tests/syntax-tests/source/ASP/test.asp+36 tests/syntax-tests/source/AppleScript/test.applescript+25 tests/syntax-tests/source/Fish/test.fish+77 tests/syntax-tests/source/Objective-C++/test.mm+68 tests/syntax-tests/source/Objective-C/test.m+32 tests/syntax-tests/source/Regular Expression/test.re+1 tests/syntax-tests/source/Ruby On Rails/test.rb+22 tests/syntax-tests/source/Tcl/test.tcl+22 tests/syntax-tests/source/Textile/test.textile+40
tests/syntax-tests/highlighted/ASP/test.aspnew file+36
@@ -0,0 +1,36 @@
1+<html>
2+<body>
3+<!-- #include file ="headers\header.inc" -->
4+
5+<%
6+For i = 0 To 5
7+Response.Write("The number is " & i & "<br />")
8+Next
9+%>
10+
11+<%
12+Response.Write("Hello World!")
13+%>
14+
15+<%
16+Dim x(2,2)
17+x(0,0)="Volvo"
18+x(0,1)="BMW"
19+x(0,2)="Ford"
20+x(1,0)="Apple"
21+x(1,1)="Orange"
22+x(1,2)="Banana"
23+x(2,0)="Coke"
24+x(2,1)="Pepsi"
25+x(2,2)="Sprite"
26+for i=0 to 2
27+response.write("<p>")
28+for j=0 to 2
29+response.write(x(i,j) & "<br />")
30+next
31+response.write("</p>")
32+next
33+%>
34+
35+</body>
36+</html>
tests/syntax-tests/highlighted/AppleScript/test.applescriptnew file+25
@@ -0,0 +1,25 @@
1+-- This is a comment
2+
3+property defaultClientName : "Mary Smith"
4+
5+on greetClient(nameOfClient)
6+ display dialog ("Hello " & nameOfClient & "!")
7+end greetClient
8+
9+
10+script testGreet
11+ greetClient(defaultClientName)
12+end script
13+
14+run testGreet
15+greetClient("Joe Jones")
16+
17+set myList to {1, "what", 3}
18+set beginning of myList to 0
19+set end of myList to "four"
20+
21+myList
22+
23+tell application "TextEdit"
24+ paragraph 1 of document 1
25+end tell
tests/syntax-tests/highlighted/Fish/test.fishnew file+77
@@ -0,0 +1,77 @@
1+set fish_greeting ""
2+
3+begin
4+ set --local AUTOJUMP_PATH $XDG_CONFIG_HOME/fish/functions/autojump.fish
5+ if test -e $AUTOJUMP_PATH
6+ source $AUTOJUMP_PATH
7+ end
8+end
9+
10+fish_vi_key_bindings
11+
12+
13+function fish_prompt
14+ set_color brblack
15+ echo -n "["(date "+%H:%M")"] "
16+ set_color blue
17+ echo -n (hostname)
18+ if [ $PWD != $HOME ]
19+ set_color brblack
20+ echo -n ':'
21+ set_color yellow
22+ echo -n (basename $PWD)
23+ end
24+ set_color green
25+ printf '%s ' (__fish_git_prompt)
26+ set_color red
27+ echo -n '| '
28+ set_color normal
29+end
30+
31+function fish_greeting
32+ echo
33+ echo -e (uname -ro | awk '{print " \\\\e[1mOS: \\\\e[0;32m"$0"\\\\e[0m"}')
34+ echo -e (uptime -p | sed 's/^up //' | awk '{print " \\\\e[1mUptime: \\\\e[0;32m"$0"\\\\e[0m"}')
35+ echo -e (uname -n | awk '{print " \\\\e[1mHostname: \\\\e[0;32m"$0"\\\\e[0m"}')
36+ echo -e " \\e[1mDisk usage:\\e[0m"
37+ echo
38+ echo -ne (\
39+ df -l -h | grep -E 'dev/(xvda|sd|mapper)' | \
40+ awk '{printf "\\\\t%s\\\\t%4s / %4s %s\\\\n\n", $6, $3, $2, $5}' | \
41+ sed -e 's/^\(.*\([8][5-9]\|[9][0-9]\)%.*\)$/\\\\e[0;31m\1\\\\e[0m/' -e 's/^\(.*\([7][5-9]\|[8][0-4]\)%.*\)$/\\\\e[0;33m\1\\\\e[0m/' | \
42+ paste -sd ''\
43+ )
44+ echo
45+
46+ echo -e " \\e[1mNetwork:\\e[0m"
47+ echo
48+ # http://tdt.rocks/linux_network_interface_naming.html
49+ echo -ne (\
50+ ip addr show up scope global | \
51+ grep -E ': <|inet' | \
52+ sed \
53+ -e 's/^[[:digit:]]\+: //' \
54+ -e 's/: <.*//' \
55+ -e 's/.*inet[[:digit:]]* //' \
56+ -e 's/\/.*//'| \
57+ awk 'BEGIN {i=""} /\.|:/ {print i" "$0"\\\n"; next} // {i = $0}' | \
58+ sort | \
59+ column -t -R1 | \
60+ # public addresses are underlined for visibility \
61+ sed 's/ \([^ ]\+\)$/ \\\e[4m\1/' | \
62+ # private addresses are not \
63+ sed 's/m\(\(10\.\|172\.\(1[6-9]\|2[0-9]\|3[01]\)\|192\.168\.\).*\)/m\\\e[24m\1/' | \
64+ # unknown interfaces are cyan \
65+ sed 's/^\( *[^ ]\+\)/\\\e[36m\1/' | \
66+ # ethernet interfaces are normal \
67+ sed 's/\(\(en\|em\|eth\)[^ ]* .*\)/\\\e[39m\1/' | \
68+ # wireless interfaces are purple \
69+ sed 's/\(wl[^ ]* .*\)/\\\e[35m\1/' | \
70+ # wwan interfaces are yellow \
71+ sed 's/\(ww[^ ]* .*\).*/\\\e[33m\1/' | \
72+ sed 's/$/\\\e[0m/' | \
73+ sed 's/^/\t/' \
74+ )
75+ echo
76+ set_color normal
77+end
tests/syntax-tests/highlighted/Objective-C++/test.mmnew file+68
@@ -0,0 +1,68 @@
1+#import <Foundation/Foundation.h>
2+
3+class Hello {
4+ private:
5+ id greeting_text;
6+
7+ public:
8+ Hello() {
9+ greeting_text = @"Hello, world!";
10+ }
11+
12+ Hello(const char* initial_greeting_text) {
13+ greeting_text = [[NSString alloc] initWithUTF8String:initial_greeting_text];
14+ }
15+
16+ void say_hello() {
17+ printf("%s\n", [greeting_text UTF8String]);
18+ }
19+};
20+
21+@interface Greeting : NSObject {
22+ @private
23+ Hello *hello;
24+
25+}
26+- (id)init;
27+- (void)dealloc;
28+- (void)sayGreeting;
29+- (void)sayGreeting:(Hello*)greeting;
30+@end
31+
32+@implementation Greeting
33+- (id)init {
34+ self = [super init];
35+ if (self) {
36+ hello = new Hello();
37+ }
38+ return self;
39+}
40+
41+- (void)dealloc {
42+ delete hello;
43+ [super dealloc];
44+}
45+
46+- (void)sayGreeting {
47+ hello->say_hello();
48+}
49+
50+- (void)sayGreeting:(Hello*)greeting {
51+ greeting->say_hello();
52+}
53+@end
54+
55+int main() {
56+
57+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
58+ Greeting *greeting = [[Greeting alloc] init];
59+ [greeting sayGreeting];
60+
61+ Hello *hello = new Hello("Bonjour, monde!");
62+ [greeting sayGreeting:hello];
63+
64+ delete hello;
65+ [greeting release];
66+ [pool release];
67+ return 0;
68+}
tests/syntax-tests/highlighted/Objective-C/test.mnew file+32
@@ -0,0 +1,32 @@
1+#import <myClass.h>
2+@import Foundation
3+// Single line comments
4+
5+/*
6+ * Multi line comment
7+ */
8+
9+int main (int argc, const char * argv[]) {
10+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
11+
12+ NSLog(@"Storage size for int : %d \n", sizeof(int));
13+ NSLog (@"hello world");
14+ if (NO)
15+ {
16+ NSLog(@"I am never run");
17+ } else if (0)
18+ {
19+ NSLog(@"I am also never run");
20+ } else
21+ {
22+ NSLog(@"I print");
23+ }
24+
25+ [pool drain];
26+ return 0;
27+}
28+
29+@implementation MyClass {
30+ long distance;
31+ NSNumber height;
32+}
tests/syntax-tests/highlighted/Regular Expression/test.renew file+1
@@ -0,0 +1 @@
1+^\[START\]\d\D\h\H\s\S[a-z]\v\V\w\W.([a-z]){3,5}\[END\]$
tests/syntax-tests/highlighted/Ruby On Rails/test.rbnew file+22
@@ -0,0 +1,22 @@
1+class ContactsController < ApplicationController
2+ def new
3+ @contact = Contact.new
4+ end
5+
6+ def create
7+ @contact = Contact.new(secure_params)
8+ if @contact.valid?
9+ UserMailer.contact_email(@contact).deliver_now
10+ flash[:notice] = "Message sent from #{@contact.name}."
11+ redirect_to root_path
12+ else
13+ render :new
14+ end
15+ end
16+
17+ private
18+
19+ def secure_params
20+ params.require(:contact).permit(:name, :email, :content)
21+ end
22+end
tests/syntax-tests/highlighted/Tcl/test.tclnew file+22
@@ -0,0 +1,22 @@
1+set part1 hello
2+set part2 how; set part3 are
3+set part4 you
4+
5+set part2;
6+
7+set greeting $part1$part2$part3$part4
8+
9+set somevar {
10+ This is a literal $ sign, and this \} escaped
11+ brace remains uninterpreted
12+}
13+
14+set name Neo
15+set greeting "Hello, $name"
16+
17+variable name NotNeo
18+
19+namespace eval people {
20+ set name NeoAgain
21+}
22+
tests/syntax-tests/highlighted/Textile/test.textilenew file+40
@@ -0,0 +1,40 @@
1+###. Single line comment
2+
3+###..
4+Multi line comment.
5+
6+This line is also part of comment.
7+
8+Continues till next block element
9+
10+p. This is not a comment, but I am a paragraph.
11+
12+<!-- HTML comments can also be used -->
13+
14+
15+h1. This is an <h1>
16+
17+h2. This is an <h2>
18+
19+h3. This is an <h3>
20+
21+h4. This is an <h4>
22+
23+h5. This is an <h5>
24+
25+h6. This is an <h6>
26+
27+--
28+
29+* Item
30+** Sub-Item
31+* Another item
32+** Another sub-item
33+** Yet another sub-item
34+*** Three levels deep
35+
36+p{color:red}. This line will be red.
37+
38+%span% are enclosed in percent symbols.
39+
40+div. This is a new div element
tests/syntax-tests/source/ASP/test.aspnew file+36
@@ -0,0 +1,36 @@
1+<html>
2+<body>
3+<!-- #include file ="headers\header.inc" -->
4+
5+<%
6+For i = 0 To 5
7+Response.Write("The number is " & i & "<br />")
8+Next
9+%>
10+
11+<%
12+Response.Write("Hello World!")
13+%>
14+
15+<%
16+Dim x(2,2)
17+x(0,0)="Volvo"
18+x(0,1)="BMW"
19+x(0,2)="Ford"
20+x(1,0)="Apple"
21+x(1,1)="Orange"
22+x(1,2)="Banana"
23+x(2,0)="Coke"
24+x(2,1)="Pepsi"
25+x(2,2)="Sprite"
26+for i=0 to 2
27+response.write("<p>")
28+for j=0 to 2
29+response.write(x(i,j) & "<br />")
30+next
31+response.write("</p>")
32+next
33+%>
34+
35+</body>
36+</html>
tests/syntax-tests/source/AppleScript/test.applescriptnew file+25
@@ -0,0 +1,25 @@
1+-- This is a comment
2+
3+property defaultClientName : "Mary Smith"
4+
5+on greetClient(nameOfClient)
6+ display dialog ("Hello " & nameOfClient & "!")
7+end greetClient
8+
9+
10+script testGreet
11+ greetClient(defaultClientName)
12+end script
13+
14+run testGreet
15+greetClient("Joe Jones")
16+
17+set myList to {1, "what", 3}
18+set beginning of myList to 0
19+set end of myList to "four"
20+
21+myList
22+
23+tell application "TextEdit"
24+ paragraph 1 of document 1
25+end tell
tests/syntax-tests/source/Fish/test.fishnew file+77
@@ -0,0 +1,77 @@
1+set fish_greeting ""
2+
3+begin
4+ set --local AUTOJUMP_PATH $XDG_CONFIG_HOME/fish/functions/autojump.fish
5+ if test -e $AUTOJUMP_PATH
6+ source $AUTOJUMP_PATH
7+ end
8+end
9+
10+fish_vi_key_bindings
11+
12+
13+function fish_prompt
14+ set_color brblack
15+ echo -n "["(date "+%H:%M")"] "
16+ set_color blue
17+ echo -n (hostname)
18+ if [ $PWD != $HOME ]
19+ set_color brblack
20+ echo -n ':'
21+ set_color yellow
22+ echo -n (basename $PWD)
23+ end
24+ set_color green
25+ printf '%s ' (__fish_git_prompt)
26+ set_color red
27+ echo -n '| '
28+ set_color normal
29+end
30+
31+function fish_greeting
32+ echo
33+ echo -e (uname -ro | awk '{print " \\\\e[1mOS: \\\\e[0;32m"$0"\\\\e[0m"}')
34+ echo -e (uptime -p | sed 's/^up //' | awk '{print " \\\\e[1mUptime: \\\\e[0;32m"$0"\\\\e[0m"}')
35+ echo -e (uname -n | awk '{print " \\\\e[1mHostname: \\\\e[0;32m"$0"\\\\e[0m"}')
36+ echo -e " \\e[1mDisk usage:\\e[0m"
37+ echo
38+ echo -ne (\
39+ df -l -h | grep -E 'dev/(xvda|sd|mapper)' | \
40+ awk '{printf "\\\\t%s\\\\t%4s / %4s %s\\\\n\n", $6, $3, $2, $5}' | \
41+ sed -e 's/^\(.*\([8][5-9]\|[9][0-9]\)%.*\)$/\\\\e[0;31m\1\\\\e[0m/' -e 's/^\(.*\([7][5-9]\|[8][0-4]\)%.*\)$/\\\\e[0;33m\1\\\\e[0m/' | \
42+ paste -sd ''\
43+ )
44+ echo
45+
46+ echo -e " \\e[1mNetwork:\\e[0m"
47+ echo
48+ # http://tdt.rocks/linux_network_interface_naming.html
49+ echo -ne (\
50+ ip addr show up scope global | \
51+ grep -E ': <|inet' | \
52+ sed \
53+ -e 's/^[[:digit:]]\+: //' \
54+ -e 's/: <.*//' \
55+ -e 's/.*inet[[:digit:]]* //' \
56+ -e 's/\/.*//'| \
57+ awk 'BEGIN {i=""} /\.|:/ {print i" "$0"\\\n"; next} // {i = $0}' | \
58+ sort | \
59+ column -t -R1 | \
60+ # public addresses are underlined for visibility \
61+ sed 's/ \([^ ]\+\)$/ \\\e[4m\1/' | \
62+ # private addresses are not \
63+ sed 's/m\(\(10\.\|172\.\(1[6-9]\|2[0-9]\|3[01]\)\|192\.168\.\).*\)/m\\\e[24m\1/' | \
64+ # unknown interfaces are cyan \
65+ sed 's/^\( *[^ ]\+\)/\\\e[36m\1/' | \
66+ # ethernet interfaces are normal \
67+ sed 's/\(\(en\|em\|eth\)[^ ]* .*\)/\\\e[39m\1/' | \
68+ # wireless interfaces are purple \
69+ sed 's/\(wl[^ ]* .*\)/\\\e[35m\1/' | \
70+ # wwan interfaces are yellow \
71+ sed 's/\(ww[^ ]* .*\).*/\\\e[33m\1/' | \
72+ sed 's/$/\\\e[0m/' | \
73+ sed 's/^/\t/' \
74+ )
75+ echo
76+ set_color normal
77+end
tests/syntax-tests/source/Objective-C++/test.mmnew file+68
@@ -0,0 +1,68 @@
1+#import <Foundation/Foundation.h>
2+
3+class Hello {
4+ private:
5+ id greeting_text;
6+
7+ public:
8+ Hello() {
9+ greeting_text = @"Hello, world!";
10+ }
11+
12+ Hello(const char* initial_greeting_text) {
13+ greeting_text = [[NSString alloc] initWithUTF8String:initial_greeting_text];
14+ }
15+
16+ void say_hello() {
17+ printf("%s\n", [greeting_text UTF8String]);
18+ }
19+};
20+
21+@interface Greeting : NSObject {
22+ @private
23+ Hello *hello;
24+
25+}
26+- (id)init;
27+- (void)dealloc;
28+- (void)sayGreeting;
29+- (void)sayGreeting:(Hello*)greeting;
30+@end
31+
32+@implementation Greeting
33+- (id)init {
34+ self = [super init];
35+ if (self) {
36+ hello = new Hello();
37+ }
38+ return self;
39+}
40+
41+- (void)dealloc {
42+ delete hello;
43+ [super dealloc];
44+}
45+
46+- (void)sayGreeting {
47+ hello->say_hello();
48+}
49+
50+- (void)sayGreeting:(Hello*)greeting {
51+ greeting->say_hello();
52+}
53+@end
54+
55+int main() {
56+
57+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
58+ Greeting *greeting = [[Greeting alloc] init];
59+ [greeting sayGreeting];
60+
61+ Hello *hello = new Hello("Bonjour, monde!");
62+ [greeting sayGreeting:hello];
63+
64+ delete hello;
65+ [greeting release];
66+ [pool release];
67+ return 0;
68+}
tests/syntax-tests/source/Objective-C/test.mnew file+32
@@ -0,0 +1,32 @@
1+#import <myClass.h>
2+@import Foundation
3+// Single line comments
4+
5+/*
6+ * Multi line comment
7+ */
8+
9+int main (int argc, const char * argv[]) {
10+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
11+
12+ NSLog(@"Storage size for int : %d \n", sizeof(int));
13+ NSLog (@"hello world");
14+ if (NO)
15+ {
16+ NSLog(@"I am never run");
17+ } else if (0)
18+ {
19+ NSLog(@"I am also never run");
20+ } else
21+ {
22+ NSLog(@"I print");
23+ }
24+
25+ [pool drain];
26+ return 0;
27+}
28+
29+@implementation MyClass {
30+ long distance;
31+ NSNumber height;
32+}
tests/syntax-tests/source/Regular Expression/test.renew file+1
@@ -0,0 +1 @@
1+^\[START\]\d\D\h\H\s\S[a-z]\v\V\w\W.([a-z]){3,5}\[END\]$
tests/syntax-tests/source/Ruby On Rails/test.rbnew file+22
@@ -0,0 +1,22 @@
1+class ContactsController < ApplicationController
2+ def new
3+ @contact = Contact.new
4+ end
5+
6+ def create
7+ @contact = Contact.new(secure_params)
8+ if @contact.valid?
9+ UserMailer.contact_email(@contact).deliver_now
10+ flash[:notice] = "Message sent from #{@contact.name}."
11+ redirect_to root_path
12+ else
13+ render :new
14+ end
15+ end
16+
17+ private
18+
19+ def secure_params
20+ params.require(:contact).permit(:name, :email, :content)
21+ end
22+end
tests/syntax-tests/source/Tcl/test.tclnew file+22
@@ -0,0 +1,22 @@
1+set part1 hello
2+set part2 how; set part3 are
3+set part4 you
4+
5+set part2;
6+
7+set greeting $part1$part2$part3$part4
8+
9+set somevar {
10+ This is a literal $ sign, and this \} escaped
11+ brace remains uninterpreted
12+}
13+
14+set name Neo
15+set greeting "Hello, $name"
16+
17+variable name NotNeo
18+
19+namespace eval people {
20+ set name NeoAgain
21+}
22+
tests/syntax-tests/source/Textile/test.textilenew file+40
@@ -0,0 +1,40 @@
1+###. Single line comment
2+
3+###..
4+Multi line comment.
5+
6+This line is also part of comment.
7+
8+Continues till next block element
9+
10+p. This is not a comment, but I am a paragraph.
11+
12+<!-- HTML comments can also be used -->
13+
14+
15+h1. This is an <h1>
16+
17+h2. This is an <h2>
18+
19+h3. This is an <h3>
20+
21+h4. This is an <h4>
22+
23+h5. This is an <h5>
24+
25+h6. This is an <h6>
26+
27+--
28+
29+* Item
30+** Sub-Item
31+* Another item
32+** Another sub-item
33+** Yet another sub-item
34+*** Three levels deep
35+
36+p{color:red}. This line will be red.
37+
38+%span% are enclosed in percent symbols.
39+
40+div. This is a new div element