1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-15 13:33:12 +02:00

Add test for methodop .&

This commit is contained in:
Siavash Askari Nasr 2021-05-02 12:05:17 +04:30 committed by Alec Thomas
parent ad7162c37b
commit 72795c5f9f
2 changed files with 58 additions and 0 deletions

View File

@ -16,6 +16,18 @@ fmt.Println("Hello from Go")
say $=pod[0].config<numbered>;
sub f1($a) {
$a+1;
}
2.&f1;
sub f2($a,$b) {
$a+1;
}
2.&f2(3);
#| Fibonacci with Multiple dispatch
multi sub fib (0 --> 0) {}
multi sub fib (1 --> 1) {}

View File

@ -51,6 +51,52 @@
{"type":"LiteralString","value":"numbered"},
{"type":"Punctuation","value":"\u003e;"},
{"type":"Text","value":"\n\n"},
{"type":"Keyword","value":"sub"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"f1"},
{"type":"Punctuation","value":"("},
{"type":"NameVariable","value":"$a"},
{"type":"Punctuation","value":")"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"NameVariable","value":"$a"},
{"type":"Operator","value":"+"},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n"},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Operator","value":".\u0026"},
{"type":"NameFunction","value":"f1"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n\n"},
{"type":"Keyword","value":"sub"},
{"type":"Text","value":" "},
{"type":"NameFunction","value":"f2"},
{"type":"Punctuation","value":"("},
{"type":"NameVariable","value":"$a"},
{"type":"Operator","value":","},
{"type":"NameVariable","value":"$b"},
{"type":"Punctuation","value":")"},
{"type":"Text","value":" "},
{"type":"Punctuation","value":"{"},
{"type":"Text","value":"\n "},
{"type":"NameVariable","value":"$a"},
{"type":"Operator","value":"+"},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n"},
{"type":"LiteralNumberInteger","value":"2"},
{"type":"Operator","value":".\u0026"},
{"type":"NameFunction","value":"f2"},
{"type":"Punctuation","value":"("},
{"type":"LiteralNumberInteger","value":"3"},
{"type":"Punctuation","value":");"},
{"type":"Text","value":"\n\n"},
{"type":"Keyword","value":"#| "},
{"type":"LiteralStringDoc","value":"Fibonacci with Multiple dispatch\n"},
{"type":"Keyword","value":"multi"},