Skip to content

Commit 5466491

Browse files
committed
tests: Also cover happy case for fbp-diff CLI tool
1 parent 77397a7 commit 5466491

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

spec/cli.coffee

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ fbpDiff = (a, b, options = {}, callback) ->
1313
s = { stdout: stdout, stderr: stderr }
1414
return callback err, s
1515

16+
fixture = (p) ->
17+
path = require 'path'
18+
return path.join __dirname, 'fixtures', p
19+
1620
describe 'fbp-diff', ->
1721
describe 'with non-existant files', ->
1822
it 'should exit with error', (done) ->
@@ -21,3 +25,17 @@ describe 'fbp-diff', ->
2125
chai.expect(streams.stderr).to.contain 'no such file'
2226
chai.expect(streams.stderr).to.contain 'nonexist.'
2327
done()
28+
29+
describe 'with two .fbp files with changes', ->
30+
output = ''
31+
it 'should succeed', (done) ->
32+
a = fixture 'fbp-git-diff-nZC2/from.PortalLights.fbp'
33+
b = fixture 'fbp-git-diff-nZC2/to.PortalLights.fbp'
34+
fbpDiff a, b, {}, (err, streams) ->
35+
chai.expect(err).to.not.exist
36+
output = streams.stdout
37+
done()
38+
it 'stdout should contain a diff', ->
39+
chai.expect(output).to.be.a 'string'
40+
chai.expect(output).to.contain '- "true" -> HWSPI ledchain'
41+
chai.expect(output).to.contain '- OUTPORT=ledchain.PIXELSET:PIXELSET'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# @runtime microflo
2+
3+
INPORT=ledchain.IN:PIXEL
4+
INPORT=ledchain.SHOW:SHOW
5+
OUTPORT=ledchain.PIXELSET:PIXELSET
6+
OUTPORT=ledchain.READY:READY
7+
OUTPORT=ledchain.SHOWN:SHOWN
8+
9+
#'2' -> PINDATA ledchain(LedChainWS)
10+
#'3' -> PINCLK ledchain
11+
'true' -> HWSPI ledchain(LedChainWS)
12+
'50' -> PIXELS ledchain
13+
#'[37, "0x404040"]' -> IN ledchain
14+
#'true' -> SHOW ledchain
15+
16+
# Workaround to be able to get the outport data
17+
# MicroFlo currently subscribe to packets with no destination...
18+
ledchain SHOWN -> IN dummy(Forward)
19+
ledchain READY -> IN dummyB(Forward)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# @runtime microflo
2+
3+
INPORT=ledchain.IN:PIXEL
4+
INPORT=ledchain.SHOW:SHOW
5+
OUTPORT=ledchain.READY:READY
6+
OUTPORT=ledchain.SHOWN:SHOWN
7+
8+
'2' -> PINDATA ledchain(LedChainWS)
9+
'3' -> PINCLK ledchain
10+
'50' -> PIXELS ledchain
11+
#'true' -> SHOW ledchain
12+
13+
# Workaround to be able to get the outport data
14+
# MicroFlo currently subscribe to packets with no destination...
15+
ledchain SHOWN -> IN dummy(Forward)
16+
ledchain READY -> IN dummyB(Forward)
17+

0 commit comments

Comments
 (0)