@@ -12,26 +12,27 @@ LogcatCommand = require '../../../../src/adb/command/host-transport/logcat'
12
12
13
13
describe ' LogcatCommand' , ->
14
14
15
- it " should send 'logcat -B *:I'" , (done ) ->
15
+ it " should send 'echo && logcat -B *:I'" , (done ) ->
16
16
conn = new MockConnection
17
17
cmd = new LogcatCommand conn
18
18
conn .socket .on ' write' , (chunk ) ->
19
19
expect (chunk .toString ()).to .equal \
20
- Protocol .encodeData (' shell:logcat -B *:I 2>/dev/null' ).toString ()
20
+ Protocol .encodeData (' shell:echo &&
21
+ logcat -B *:I 2>/dev/null' ).toString ()
21
22
setImmediate ->
22
23
conn .socket .causeRead Protocol .OKAY
23
24
conn .socket .causeEnd ()
24
25
cmd .execute ()
25
26
.then (stream) ->
26
27
done ()
27
28
28
- it " should send 'logcat -c && logcat -B *:I' if options.clear
29
+ it " should send 'echo && logcat -c && logcat -B *:I' if options.clear
29
30
is set" , (done ) ->
30
31
conn = new MockConnection
31
32
cmd = new LogcatCommand conn
32
33
conn .socket .on ' write' , (chunk ) ->
33
34
expect (chunk .toString ()).to .equal \
34
- Protocol .encodeData (' shell:logcat -c 2>/dev/null &&
35
+ Protocol .encodeData (' shell:echo && logcat -c 2>/dev/null &&
35
36
logcat -B *:I 2>/dev/null' ).toString ()
36
37
setImmediate ->
37
38
conn .socket .causeRead Protocol .OKAY
@@ -51,7 +52,7 @@ describe 'LogcatCommand', ->
51
52
expect (stream).to .be .an .instanceof Stream .Readable
52
53
done ()
53
54
54
- it " should perform CRLF transformation" , (done ) ->
55
+ it " should perform CRLF transformation by default " , (done ) ->
55
56
conn = new MockConnection
56
57
cmd = new LogcatCommand conn
57
58
setImmediate ->
@@ -64,3 +65,17 @@ describe 'LogcatCommand', ->
64
65
.then (out) ->
65
66
expect (out .toString ()).to .equal ' foo\n '
66
67
done ()
68
+
69
+ it " should not perform CRLF transformation if not needed" , (done ) ->
70
+ conn = new MockConnection
71
+ cmd = new LogcatCommand conn
72
+ setImmediate ->
73
+ conn .socket .causeRead Protocol .OKAY
74
+ conn .socket .causeRead ' \n foo\r\n '
75
+ conn .socket .causeEnd ()
76
+ cmd .execute ()
77
+ .then (stream) ->
78
+ new Parser (stream).readAll ()
79
+ .then (out) ->
80
+ expect (out .toString ()).to .equal ' \n foo\r\n '
81
+ done ()
0 commit comments