@@ -40,23 +40,81 @@ const props = {
40
40
compilers : "goodCompiler:&badCompiler"
41
41
} ;
42
42
43
+ const noOptionsAtAll = {
44
+ compilers : "goodCompiler"
45
+ } ;
46
+
47
+ const noBaseOptions = {
48
+ compilers : "goodCompiler" ,
49
+ options : "bar"
50
+ } ;
51
+
52
+ const onlyBaseOptions = {
53
+ compilers : "goodCompiler" ,
54
+ baseOptions : "foo"
55
+ } ;
56
+
57
+ const bothOptions = {
58
+ compilers : "goodCompiler" ,
59
+ baseOptions : "foo" ,
60
+ options : "bar"
61
+ } ;
62
+
43
63
describe ( 'Compiler-finder' , function ( ) {
44
64
let compilerProps ;
45
65
66
+ let noOptionsAtAllProps ;
67
+ let noBaseOptionsProps ;
68
+ let onlyBaseOptionsProps ;
69
+ let bothOptionsProps ;
70
+
71
+ let optionsHandler ;
72
+
46
73
before ( ( ) => {
47
74
compilerProps = new properties . CompilerProps ( languages , properties . fakeProps ( props ) ) ;
48
- } ) ;
49
75
50
- it ( 'should not hang for undefined groups (Bug #860)' , ( ) => {
51
- const optionsHandler = {
76
+ noOptionsAtAllProps = new properties . CompilerProps ( languages , properties . fakeProps ( noOptionsAtAll ) ) ;
77
+ noBaseOptionsProps = new properties . CompilerProps ( languages , properties . fakeProps ( noBaseOptions ) ) ;
78
+ onlyBaseOptionsProps = new properties . CompilerProps ( languages , properties . fakeProps ( onlyBaseOptions ) ) ;
79
+ bothOptionsProps = new properties . CompilerProps ( languages , properties . fakeProps ( bothOptions ) ) ;
80
+
81
+ optionsHandler = {
52
82
get : ( ) => {
53
83
return {
54
84
libs : { } ,
55
85
tools : { }
56
86
} ;
57
87
}
58
88
} ;
89
+ } ) ;
90
+
91
+ it ( 'should not hang for undefined groups (Bug #860)' , ( ) => {
92
+
59
93
const finder = new CompilerFinder ( { } , compilerProps , properties . fakeProps ( { } ) , { } , optionsHandler ) ;
60
94
return finder . getCompilers ( ) . should . eventually . have . lengthOf ( 2 ) ;
61
- } )
95
+ } ) ;
96
+
97
+ it ( 'should behave properly if no options are provided at all' , async ( ) => {
98
+ const finder = new CompilerFinder ( { } , noOptionsAtAllProps , properties . fakeProps ( { } ) , { } , optionsHandler ) ;
99
+ const compilers = await finder . getCompilers ( ) ;
100
+ compilers [ 0 ] . options . should . equal ( '' ) ;
101
+ } ) ;
102
+
103
+ it ( 'should behave properly if no base options are provided' , async ( ) => {
104
+ const finder = new CompilerFinder ( { } , noBaseOptionsProps , properties . fakeProps ( { } ) , { } , optionsHandler ) ;
105
+ const compilers = await finder . getCompilers ( ) ;
106
+ compilers [ 0 ] . options . should . equal ( 'bar' ) ;
107
+ } ) ;
108
+
109
+ it ( 'should behave properly if only base options are provided' , async ( ) => {
110
+ const finder = new CompilerFinder ( { } , onlyBaseOptionsProps , properties . fakeProps ( { } ) , { } , optionsHandler ) ;
111
+ const compilers = await finder . getCompilers ( ) ;
112
+ compilers [ 0 ] . options . should . equal ( 'foo' ) ;
113
+ } ) ;
114
+
115
+ it ( 'should behave properly if both options are provided' , async ( ) => {
116
+ const finder = new CompilerFinder ( { } , bothOptionsProps , properties . fakeProps ( { } ) , { } , optionsHandler ) ;
117
+ const compilers = await finder . getCompilers ( ) ;
118
+ compilers [ 0 ] . options . should . equal ( 'foo bar' ) ;
119
+ } ) ;
62
120
} ) ;
0 commit comments