Skip to content

Commit

Permalink
Fixes and tests for config directives
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson committed Jul 6, 2017
1 parent 5db0616 commit 69913bd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/config.lsc
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ eatDirective(code, directives) ->
else:
dqMatches = code.match(/^"((?:[^"\\]|\\.)*)"\s*;?\s*([^]*)$/)
if dqMatches:
directives.push(matches[1])
matches[2]
directives.push(dqMatches[1])
dqMatches[2]
else:
code

Expand Down
15 changes: 15 additions & 0 deletions test/fixtures/configuration-directives/multiple/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// comment 1
'use @oigroup/lightscript'
/*
* comment 2
*/
"use @oigroup/lightscript with noEnforcedSubscriptIndentation";
// comment 3
'use strict'
/*
comment 4
*/
'use @oigroup/lightscript with safeCall'

a?()
.b
14 changes: 14 additions & 0 deletions test/fixtures/configuration-directives/multiple/expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// comment 1
'use @oigroup/lightscript';
/*
* comment 2
*/
"use @oigroup/lightscript with noEnforcedSubscriptIndentation";
// comment 3
'use strict';
/*
comment 4
*/
'use @oigroup/lightscript with safeCall';

(typeof a === 'function' ? a() : null).b;

0 comments on commit 69913bd

Please sign in to comment.