From 591eba66a3af1c211a09eefd17cbeb819b0a131f Mon Sep 17 00:00:00 2001 From: henil Date: Sun, 15 Nov 2020 00:22:08 +0530 Subject: add new syntax test files --- tests/syntax-tests/highlighted/ASP/test.asp | 36 ++++++++++ .../highlighted/AppleScript/test.applescript | 25 +++++++ tests/syntax-tests/highlighted/Fish/test.fish | 77 ++++++++++++++++++++++ .../syntax-tests/highlighted/Objective-C++/test.mm | 68 +++++++++++++++++++ tests/syntax-tests/highlighted/Objective-C/test.m | 32 +++++++++ .../highlighted/Regular Expression/test.re | 1 + .../syntax-tests/highlighted/Ruby On Rails/test.rb | 22 +++++++ tests/syntax-tests/highlighted/Tcl/test.tcl | 22 +++++++ .../syntax-tests/highlighted/Textile/test.textile | 40 +++++++++++ tests/syntax-tests/source/ASP/test.asp | 36 ++++++++++ .../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 +++++++++ .../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 +++++++++++ 18 files changed, 646 insertions(+) create mode 100644 tests/syntax-tests/highlighted/ASP/test.asp create mode 100644 tests/syntax-tests/highlighted/AppleScript/test.applescript create mode 100644 tests/syntax-tests/highlighted/Fish/test.fish create mode 100644 tests/syntax-tests/highlighted/Objective-C++/test.mm create mode 100644 tests/syntax-tests/highlighted/Objective-C/test.m create mode 100644 tests/syntax-tests/highlighted/Regular Expression/test.re create mode 100644 tests/syntax-tests/highlighted/Ruby On Rails/test.rb create mode 100644 tests/syntax-tests/highlighted/Tcl/test.tcl create mode 100644 tests/syntax-tests/highlighted/Textile/test.textile create mode 100644 tests/syntax-tests/source/ASP/test.asp create mode 100644 tests/syntax-tests/source/AppleScript/test.applescript create mode 100644 tests/syntax-tests/source/Fish/test.fish create mode 100644 tests/syntax-tests/source/Objective-C++/test.mm create mode 100644 tests/syntax-tests/source/Objective-C/test.m create mode 100644 tests/syntax-tests/source/Regular Expression/test.re create mode 100644 tests/syntax-tests/source/Ruby On Rails/test.rb create mode 100644 tests/syntax-tests/source/Tcl/test.tcl create mode 100644 tests/syntax-tests/source/Textile/test.textile diff --git a/tests/syntax-tests/highlighted/ASP/test.asp b/tests/syntax-tests/highlighted/ASP/test.asp new file mode 100644 index 00000000..db610895 --- /dev/null +++ b/tests/syntax-tests/highlighted/ASP/test.asp @@ -0,0 +1,36 @@ +<html> +<body> + + +<% +For i = 0 To 5 +Response.Write("The number is " & i & "
") +Next +%> + +<% +Response.Write("Hello World!") +%> + +<% +Dim x(2,2) +x(0,0)="Volvo" +x(0,1)="BMW" +x(0,2)="Ford" +x(1,0)="Apple" +x(1,1)="Orange" +x(1,2)="Banana" +x(2,0)="Coke" +x(2,1)="Pepsi" +x(2,2)="Sprite" +for i=0 to 2 +response.write("

") +for j=0 to 2 +response.write(x(i,j) & "
") +next +response.write("

") +next +%> + + + diff --git a/tests/syntax-tests/highlighted/AppleScript/test.applescript b/tests/syntax-tests/highlighted/AppleScript/test.applescript new file mode 100644 index 00000000..f3692a84 --- /dev/null +++ b/tests/syntax-tests/highlighted/AppleScript/test.applescript @@ -0,0 +1,25 @@ +-- This is a comment + +property defaultClientName : "Mary Smith" + +on greetClient(nameOfClient) + display dialog ("Hello " & nameOfClient & "!") +end greetClient + + +script testGreet + greetClient(defaultClientName) +end script + +run testGreet +greetClient("Joe Jones") + +set myList to {1, "what", 3} +set beginning of myList to 0 +set end of myList to "four" + +myList + +tell application "TextEdit" + paragraph 1 of document 1 +end tell diff --git a/tests/syntax-tests/highlighted/Fish/test.fish b/tests/syntax-tests/highlighted/Fish/test.fish new file mode 100644 index 00000000..3e7d8b86 --- /dev/null +++ b/tests/syntax-tests/highlighted/Fish/test.fish @@ -0,0 +1,77 @@ +set fish_greeting "" + +begin + set --local AUTOJUMP_PATH $XDG_CONFIG_HOME/fish/functions/autojump.fish + if test -e $AUTOJUMP_PATH + source $AUTOJUMP_PATH + end +end + +fish_vi_key_bindings + + +function fish_prompt + set_color brblack + echo -n "["(date "+%H:%M")"] " + set_color blue + echo -n (hostname) + if [ $PWD != $HOME ] + set_color brblack + echo -n ':' + set_color yellow + echo -n (basename $PWD) + end + set_color green + printf '%s ' (__fish_git_prompt) + set_color red + echo -n '| ' + set_color normal +end + +function fish_greeting + echo + echo -e (uname -ro | awk '{print " \\\\e[1mOS: \\\\e[0;32m"$0"\\\\e[0m"}') + echo -e (uptime -p | sed 's/^up //' | awk '{print " \\\\e[1mUptime: \\\\e[0;32m"$0"\\\\e[0m"}') + echo -e (uname -n | awk '{print " \\\\e[1mHostname: \\\\e[0;32m"$0"\\\\e[0m"}') + echo -e " \\e[1mDisk usage:\\e[0m" + echo + echo -ne (\ + df -l -h | grep -E 'dev/(xvda|sd|mapper)' | \ + awk '{printf "\\\\t%s\\\\t%4s / %4s %s\\\\n\n", $6, $3, $2, $5}' | \ + 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/' | \ + paste -sd ''\ + ) + echo + + echo -e " \\e[1mNetwork:\\e[0m" + echo + # http://tdt.rocks/linux_network_interface_naming.html + echo -ne (\ + ip addr show up scope global | \ + grep -E ': <|inet' | \ + sed \ + -e 's/^[[:digit:]]\+: //' \ + -e 's/: <.*//' \ + -e 's/.*inet[[:digit:]]* //' \ + -e 's/\/.*//'| \ + awk 'BEGIN {i=""} /\.|:/ {print i" "$0"\\\n"; next} // {i = $0}' | \ + sort | \ + column -t -R1 | \ + # public addresses are underlined for visibility \ + sed 's/ \([^ ]\+\)$/ \\\e[4m\1/' | \ + # private addresses are not \ + sed 's/m\(\(10\.\|172\.\(1[6-9]\|2[0-9]\|3[01]\)\|192\.168\.\).*\)/m\\\e[24m\1/' | \ + # unknown interfaces are cyan \ + sed 's/^\( *[^ ]\+\)/\\\e[36m\1/' | \ + # ethernet interfaces are normal \ + sed 's/\(\(en\|em\|eth\)[^ ]* .*\)/\\\e[39m\1/' | \ + # wireless interfaces are purple \ + sed 's/\(wl[^ ]* .*\)/\\\e[35m\1/' | \ + # wwan interfaces are yellow \ + sed 's/\(ww[^ ]* .*\).*/\\\e[33m\1/' | \ + sed 's/$/\\\e[0m/' | \ + sed 's/^/\t/' \ + ) + echo + set_color normal +end diff --git a/tests/syntax-tests/highlighted/Objective-C++/test.mm b/tests/syntax-tests/highlighted/Objective-C++/test.mm new file mode 100644 index 00000000..51989020 --- /dev/null +++ b/tests/syntax-tests/highlighted/Objective-C++/test.mm @@ -0,0 +1,68 @@ +#import <Foundation/Foundation.h> + +class Hello { + private: + id greeting_text; + + public: + Hello() { + greeting_text = @"Hello, world!"; + } + + Hello(const char* initial_greeting_text) { + greeting_text = [[NSString alloc] initWithUTF8String:initial_greeting_text]; + } + + void say_hello() { + printf("%s\n", [greeting_text UTF8String]); + } +}; + +@interface Greeting : NSObject { + @private + Hello *hello; + +} +- (id)init; +- (void)dealloc; +- (void)sayGreeting; +- (void)sayGreeting:(Hello*)greeting; +@end + +@implementation Greeting +- (id)init { + self = [super init]; + if (self) { + hello = new Hello(); + } + return self; +} + +- (void)dealloc { + delete hello; + [super dealloc]; +} + +- (void)sayGreeting { + hello->say_hello(); +} + +- (void)sayGreeting:(Hello*)greeting { + greeting->say_hello(); +} +@end + +int main() { + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + Greeting *greeting = [[Greeting alloc] init]; + [greeting sayGreeting]; + + Hello *hello = new Hello("Bonjour, monde!"); + [greeting sayGreeting:hello]; + + delete hello; + [greeting release]; + [pool release]; + return 0; +} diff --git a/tests/syntax-tests/highlighted/Objective-C/test.m b/tests/syntax-tests/highlighted/Objective-C/test.m new file mode 100644 index 00000000..287c7400 --- /dev/null +++ b/tests/syntax-tests/highlighted/Objective-C/test.m @@ -0,0 +1,32 @@ +#import <myClass.h> +@import Foundation +// Single line comments + +/* + * Multi line comment + */ + +int main (int argc, const char * argv[]) { + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + NSLog(@"Storage size for int : %d \n", sizeof(int)); + NSLog (@"hello world"); + if (NO) + { + NSLog(@"I am never run"); + } else if (0) + { + NSLog(@"I am also never run"); + } else + { + NSLog(@"I print"); + } + + [pool drain]; + return 0; +} + +@implementation MyClass { + long distance; + NSNumber height; +} diff --git a/tests/syntax-tests/highlighted/Regular Expression/test.re b/tests/syntax-tests/highlighted/Regular Expression/test.re new file mode 100644 index 00000000..912b568b --- /dev/null +++ b/tests/syntax-tests/highlighted/Regular Expression/test.re @@ -0,0 +1 @@ +^\[START\]\d\D\h\H\s\S[a-z]\v\V\w\W.([a-z]){3,5}\[END\]$ diff --git a/tests/syntax-tests/highlighted/Ruby On Rails/test.rb b/tests/syntax-tests/highlighted/Ruby On Rails/test.rb new file mode 100644 index 00000000..9b2a9b66 --- /dev/null +++ b/tests/syntax-tests/highlighted/Ruby On Rails/test.rb @@ -0,0 +1,22 @@ +class ContactsController < ApplicationController + def new + @contact = Contact.new + end + + def create + @contact = Contact.new(secure_params) + if @contact.valid? + UserMailer.contact_email(@contact).deliver_now + flash[:notice] = "Message sent from #{@contact.name}." + redirect_to root_path + else + render :new + end + end + + private + + def secure_params + params.require(:contact).permit(:name, :email, :content) + end +end diff --git a/tests/syntax-tests/highlighted/Tcl/test.tcl b/tests/syntax-tests/highlighted/Tcl/test.tcl new file mode 100644 index 00000000..8c87e2c7 --- /dev/null +++ b/tests/syntax-tests/highlighted/Tcl/test.tcl @@ -0,0 +1,22 @@ +set part1 hello +set part2 how; set part3 are +set part4 you + +set part2; + +set greeting $part1$part2$part3$part4 + +set somevar { + This is a literal $ sign, and this \} escaped + brace remains uninterpreted +} + +set name Neo +set greeting "Hello, $name" + +variable name NotNeo + +namespace eval people { + set name NeoAgain +} + diff --git a/tests/syntax-tests/highlighted/Textile/test.textile b/tests/syntax-tests/highlighted/Textile/test.textile new file mode 100644 index 00000000..f0b7a71d --- /dev/null +++ b/tests/syntax-tests/highlighted/Textile/test.textile @@ -0,0 +1,40 @@ +###. Single line comment + +###.. +Multi line comment. + +This line is also part of comment. + +Continues till next block element + +p. This is not a comment, but I am a paragraph. + + + + +h1. This is an <h1> + +h2. This is an <h2> + +h3. This is an <h3> + +h4. This is an <h4> + +h5. This is an <h5> + +h6. This is an <h6> + +-- + +* Item +** Sub-Item +* Another item +** Another sub-item +** Yet another sub-item +*** Three levels deep + +p{color:red}. This line will be red. + +%span% are enclosed in percent symbols. + +div. This is a new div element diff --git a/tests/syntax-tests/source/ASP/test.asp b/tests/syntax-tests/source/ASP/test.asp new file mode 100644 index 00000000..ebb01e82 --- /dev/null +++ b/tests/syntax-tests/source/ASP/test.asp @@ -0,0 +1,36 @@ + + + + +<% +For i = 0 To 5 +Response.Write("The number is " & i & "
") +Next +%> + +<% +Response.Write("Hello World!") +%> + +<% +Dim x(2,2) +x(0,0)="Volvo" +x(0,1)="BMW" +x(0,2)="Ford" +x(1,0)="Apple" +x(1,1)="Orange" +x(1,2)="Banana" +x(2,0)="Coke" +x(2,1)="Pepsi" +x(2,2)="Sprite" +for i=0 to 2 +response.write("

") +for j=0 to 2 +response.write(x(i,j) & "
") +next +response.write("

") +next +%> + + + diff --git a/tests/syntax-tests/source/AppleScript/test.applescript b/tests/syntax-tests/source/AppleScript/test.applescript new file mode 100644 index 00000000..e739a9ff --- /dev/null +++ b/tests/syntax-tests/source/AppleScript/test.applescript @@ -0,0 +1,25 @@ +-- This is a comment + +property defaultClientName : "Mary Smith" + +on greetClient(nameOfClient) + display dialog ("Hello " & nameOfClient & "!") +end greetClient + + +script testGreet + greetClient(defaultClientName) +end script + +run testGreet +greetClient("Joe Jones") + +set myList to {1, "what", 3} +set beginning of myList to 0 +set end of myList to "four" + +myList + +tell application "TextEdit" + paragraph 1 of document 1 +end tell diff --git a/tests/syntax-tests/source/Fish/test.fish b/tests/syntax-tests/source/Fish/test.fish new file mode 100644 index 00000000..541b2e4f --- /dev/null +++ b/tests/syntax-tests/source/Fish/test.fish @@ -0,0 +1,77 @@ +set fish_greeting "" + +begin + set --local AUTOJUMP_PATH $XDG_CONFIG_HOME/fish/functions/autojump.fish + if test -e $AUTOJUMP_PATH + source $AUTOJUMP_PATH + end +end + +fish_vi_key_bindings + + +function fish_prompt + set_color brblack + echo -n "["(date "+%H:%M")"] " + set_color blue + echo -n (hostname) + if [ $PWD != $HOME ] + set_color brblack + echo -n ':' + set_color yellow + echo -n (basename $PWD) + end + set_color green + printf '%s ' (__fish_git_prompt) + set_color red + echo -n '| ' + set_color normal +end + +function fish_greeting + echo + echo -e (uname -ro | awk '{print " \\\\e[1mOS: \\\\e[0;32m"$0"\\\\e[0m"}') + echo -e (uptime -p | sed 's/^up //' | awk '{print " \\\\e[1mUptime: \\\\e[0;32m"$0"\\\\e[0m"}') + echo -e (uname -n | awk '{print " \\\\e[1mHostname: \\\\e[0;32m"$0"\\\\e[0m"}') + echo -e " \\e[1mDisk usage:\\e[0m" + echo + echo -ne (\ + df -l -h | grep -E 'dev/(xvda|sd|mapper)' | \ + awk '{printf "\\\\t%s\\\\t%4s / %4s %s\\\\n\n", $6, $3, $2, $5}' | \ + 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/' | \ + paste -sd ''\ + ) + echo + + echo -e " \\e[1mNetwork:\\e[0m" + echo + # http://tdt.rocks/linux_network_interface_naming.html + echo -ne (\ + ip addr show up scope global | \ + grep -E ': <|inet' | \ + sed \ + -e 's/^[[:digit:]]\+: //' \ + -e 's/: <.*//' \ + -e 's/.*inet[[:digit:]]* //' \ + -e 's/\/.*//'| \ + awk 'BEGIN {i=""} /\.|:/ {print i" "$0"\\\n"; next} // {i = $0}' | \ + sort | \ + column -t -R1 | \ + # public addresses are underlined for visibility \ + sed 's/ \([^ ]\+\)$/ \\\e[4m\1/' | \ + # private addresses are not \ + sed 's/m\(\(10\.\|172\.\(1[6-9]\|2[0-9]\|3[01]\)\|192\.168\.\).*\)/m\\\e[24m\1/' | \ + # unknown interfaces are cyan \ + sed 's/^\( *[^ ]\+\)/\\\e[36m\1/' | \ + # ethernet interfaces are normal \ + sed 's/\(\(en\|em\|eth\)[^ ]* .*\)/\\\e[39m\1/' | \ + # wireless interfaces are purple \ + sed 's/\(wl[^ ]* .*\)/\\\e[35m\1/' | \ + # wwan interfaces are yellow \ + sed 's/\(ww[^ ]* .*\).*/\\\e[33m\1/' | \ + sed 's/$/\\\e[0m/' | \ + sed 's/^/\t/' \ + ) + echo + set_color normal +end diff --git a/tests/syntax-tests/source/Objective-C++/test.mm b/tests/syntax-tests/source/Objective-C++/test.mm new file mode 100644 index 00000000..6f8663fb --- /dev/null +++ b/tests/syntax-tests/source/Objective-C++/test.mm @@ -0,0 +1,68 @@ +#import + +class Hello { + private: + id greeting_text; + + public: + Hello() { + greeting_text = @"Hello, world!"; + } + + Hello(const char* initial_greeting_text) { + greeting_text = [[NSString alloc] initWithUTF8String:initial_greeting_text]; + } + + void say_hello() { + printf("%s\n", [greeting_text UTF8String]); + } +}; + +@interface Greeting : NSObject { + @private + Hello *hello; + +} +- (id)init; +- (void)dealloc; +- (void)sayGreeting; +- (void)sayGreeting:(Hello*)greeting; +@end + +@implementation Greeting +- (id)init { + self = [super init]; + if (self) { + hello = new Hello(); + } + return self; +} + +- (void)dealloc { + delete hello; + [super dealloc]; +} + +- (void)sayGreeting { + hello->say_hello(); +} + +- (void)sayGreeting:(Hello*)greeting { + greeting->say_hello(); +} +@end + +int main() { + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + Greeting *greeting = [[Greeting alloc] init]; + [greeting sayGreeting]; + + Hello *hello = new Hello("Bonjour, monde!"); + [greeting sayGreeting:hello]; + + delete hello; + [greeting release]; + [pool release]; + return 0; +} diff --git a/tests/syntax-tests/source/Objective-C/test.m b/tests/syntax-tests/source/Objective-C/test.m new file mode 100644 index 00000000..9ed16cba --- /dev/null +++ b/tests/syntax-tests/source/Objective-C/test.m @@ -0,0 +1,32 @@ +#import +@import Foundation +// Single line comments + +/* + * Multi line comment + */ + +int main (int argc, const char * argv[]) { + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + NSLog(@"Storage size for int : %d \n", sizeof(int)); + NSLog (@"hello world"); + if (NO) + { + NSLog(@"I am never run"); + } else if (0) + { + NSLog(@"I am also never run"); + } else + { + NSLog(@"I print"); + } + + [pool drain]; + return 0; +} + +@implementation MyClass { + long distance; + NSNumber height; +} diff --git a/tests/syntax-tests/source/Regular Expression/test.re b/tests/syntax-tests/source/Regular Expression/test.re new file mode 100644 index 00000000..7e424567 --- /dev/null +++ b/tests/syntax-tests/source/Regular Expression/test.re @@ -0,0 +1 @@ +^\[START\]\d\D\h\H\s\S[a-z]\v\V\w\W.([a-z]){3,5}\[END\]$ diff --git a/tests/syntax-tests/source/Ruby On Rails/test.rb b/tests/syntax-tests/source/Ruby On Rails/test.rb new file mode 100644 index 00000000..352f098c --- /dev/null +++ b/tests/syntax-tests/source/Ruby On Rails/test.rb @@ -0,0 +1,22 @@ +class ContactsController < ApplicationController + def new + @contact = Contact.new + end + + def create + @contact = Contact.new(secure_params) + if @contact.valid? + UserMailer.contact_email(@contact).deliver_now + flash[:notice] = "Message sent from #{@contact.name}." + redirect_to root_path + else + render :new + end + end + + private + + def secure_params + params.require(:contact).permit(:name, :email, :content) + end +end diff --git a/tests/syntax-tests/source/Tcl/test.tcl b/tests/syntax-tests/source/Tcl/test.tcl new file mode 100644 index 00000000..79027b2c --- /dev/null +++ b/tests/syntax-tests/source/Tcl/test.tcl @@ -0,0 +1,22 @@ +set part1 hello +set part2 how; set part3 are +set part4 you + +set part2; + +set greeting $part1$part2$part3$part4 + +set somevar { + This is a literal $ sign, and this \} escaped + brace remains uninterpreted +} + +set name Neo +set greeting "Hello, $name" + +variable name NotNeo + +namespace eval people { + set name NeoAgain +} + diff --git a/tests/syntax-tests/source/Textile/test.textile b/tests/syntax-tests/source/Textile/test.textile new file mode 100644 index 00000000..dd8e2ef9 --- /dev/null +++ b/tests/syntax-tests/source/Textile/test.textile @@ -0,0 +1,40 @@ +###. Single line comment + +###.. +Multi line comment. + +This line is also part of comment. + +Continues till next block element + +p. This is not a comment, but I am a paragraph. + + + + +h1. This is an

+ +h2. This is an

+ +h3. This is an

+ +h4. This is an

+ +h5. This is an

+ +h6. This is an
+ +-- + +* Item +** Sub-Item +* Another item +** Another sub-item +** Yet another sub-item +*** Three levels deep + +p{color:red}. This line will be red. + +%span% are enclosed in percent symbols. + +div. This is a new div element -- cgit v1.2.3