This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/tests/examplefiles/psysh/psysh_test.psysh
Oleh Prypin 6f43092173
Also add auto-updatable output-based tests to examplefiles (#1689)
Co-authored-by: Georg Brandl <georg@python.org>
2021-01-20 10:48:45 +01:00

47 lines
946 B
Text

>>> (int) 10.88
=> 10
>>> (string) 10.88
=> "10.88"
>>> (bool) 10.88
=> true
>>> (array) 10.88
=> [
10.88,
]
>>> $object = (object) 10.88
=> {#2373
+"scalar": 10.88,
}
>>> $object->scalar
=> 10.88
>>> $fileHandle = fopen('hello.txt', 'w');
=> stream resource #400
>>> (int) $fileHandle
=> 400
>>> (string) $fileHandle
=> "Resource id #400"
>>> $greeting = 'Hello!';
=> "Hello!"
>>> $_greeting = 'Hello!';
=> "Hello!"
>>> $gruß = 'Hallo!';
=> "Hallo!"
>>> namespace Foo\Bar;
>>> class Baz {
... public function getBaz(): string {
... return 'baz';
... }
... }
>>> $baz = new Foo\Bar\Baz();
PHP Fatal error: Class 'Foo/Bar/Foo/Bar/Baz' not
found in Psy Shell code on line 1
>>> $baz = new Baz();
=> Foo\Bar\Baz {#2382}
>>> $baz->getBaz();
=> "baz"
>>> $greeting = function($name): string {
... return "Hello, {$name}";
... };
=> Closure($name): string {#2371 …3}
>>> $greeting('World')
=> "Hello, World"