summaryrefslogtreecommitdiffstats
path: root/kjsembed/tests/test_stdio.js
blob: 932f749627c620ad070f541b1287c7b5ffd89998 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env kjscmd

println( '==============================' );

println( 'Text with newline' );
System.stdout.println( 'Text with newline' );

System.stdout.print( 'There should be an OK after the colon: ' );
System.stdout.println( 'OK' );

System.stdout.println( 'stdin is readable: ' + System.stdin.isReadable() );
System.stdout.println( 'stdin is writable: ' + System.stdin.isWritable() );

System.stdout.println( 'stdout is readable: ' + System.stdout.isReadable() );
System.stdout.println( 'stdout is writable: ' + System.stdout.isWritable() );

System.stdout.println( 'stderr is readable: ' + System.stderr.isReadable() );
System.stdout.println( 'stderr is writable: ' + System.stderr.isWritable() );

System.stdout.println( 'There should be an exception now: ' );
System.stdin.println( 'INVALID' );

System.stdout.println( 'There should be another exception: ' );
System.stdout.readLine( 'INVALID' );

println( '==============================' );
System.stdout.println( dump(System.stdin) );

System.exit(0);