diff options
author | Georg Brandl <georg@python.org> | 2012-02-05 12:18:36 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2012-02-05 12:18:36 +0100 |
commit | da12a8923f1f63c3f77c67123ead5a6c3368ff1b (patch) | |
tree | 26f68fe4c655fff6aecbde3e62496189c103ebff /tests/examplefiles/test.dart | |
parent | 853ead03f3dea69a76d34e9bb5a85d4df881ed59 (diff) | |
download | pygments-da12a8923f1f63c3f77c67123ead5a6c3368ff1b.tar.gz |
Closes #715: Add Dart lexer.
Diffstat (limited to 'tests/examplefiles/test.dart')
-rw-r--r-- | tests/examplefiles/test.dart | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/examplefiles/test.dart b/tests/examplefiles/test.dart new file mode 100644 index 00000000..aa1fb0ed --- /dev/null +++ b/tests/examplefiles/test.dart @@ -0,0 +1,23 @@ +// Greeter example from +// <http://www.dartlang.org/docs/getting-started/interface.html> +class Greeter implements Comparable { + String prefix = 'Hello,'; + Greeter() {} + Greeter.withPrefix(this.prefix); + greet(String name) => print('$prefix $name'); + + int compareTo(Greeter other) => prefix.compareTo(other.prefix); +} + +void main() { + Greeter greeter = new Greeter(); + Greeter greeter2 = new Greeter.withPrefix('Hi,'); + + num result = greeter2.compareTo(greeter); + if (result == 0) { + greeter2.greet('you are the same.'); + } else { + greeter2.greet('you are different.'); + } +} + |