File tree Expand file tree Collapse file tree 2 files changed +80
-0
lines changed Expand file tree Collapse file tree 2 files changed +80
-0
lines changed Original file line number Diff line number Diff line change 100
100
end
101
101
end
102
102
end
103
+
104
+ it 'rejects a compiler function from a different compilation' do
105
+ plus_one = nil
106
+ Sass . compile_string (
107
+ "
108
+ @use 'sass:meta';
109
+
110
+ @function plusOne($n) {@return $n + 1}
111
+ a {b: meta.call(foo(meta.get-function('plusOne')), 2)}
112
+ " ,
113
+ functions : {
114
+ 'foo($arg)' : -> ( args ) { plus_one = args [ 0 ] }
115
+ }
116
+ )
117
+
118
+ plus_two = nil
119
+ expect do
120
+ Sass . compile_string (
121
+ "
122
+ @use 'sass:meta';
123
+
124
+ @function plusTwo($n) {@return $n + 2}
125
+ a {b: meta.call(foo(meta.get-function('plusTwo')), 2)}
126
+ " ,
127
+ functions : {
128
+ 'foo($arg)' : lambda { |args |
129
+ plus_two = args [ 0 ]
130
+ plus_one
131
+ }
132
+ }
133
+ )
134
+ end . to raise_sass_compile_error . with_line ( 4 )
135
+
136
+ expect ( plus_one ) . not_to eq ( plus_two )
137
+ end
103
138
end
Original file line number Diff line number Diff line change 45
45
46
46
expect ( fn ) . to have_received ( :call )
47
47
end
48
+
49
+ it 'rejects a compiler mixin from a different compilation' do
50
+ a = nil
51
+ Sass . compile_string (
52
+ "
53
+ @use 'sass:meta';
54
+
55
+ @mixin a() {
56
+ a {
57
+ b: c;
58
+ }
59
+ }
60
+
61
+ @include meta.apply(foo(meta.get-mixin('a')));
62
+ " ,
63
+ functions : {
64
+ 'foo($arg)' : -> ( args ) { a = args [ 0 ] }
65
+ }
66
+ )
67
+
68
+ b = nil
69
+ expect do
70
+ Sass . compile_string (
71
+ "
72
+ @use 'sass:meta';
73
+
74
+ @mixin b() {
75
+ c {
76
+ d: e;
77
+ }
78
+ }
79
+
80
+ @include meta.apply(foo(meta.get-mixin('b')));
81
+ " ,
82
+ functions : {
83
+ 'foo($arg)' : lambda { |args |
84
+ b = args [ 0 ]
85
+ a
86
+ }
87
+ }
88
+ )
89
+ end . to raise_sass_compile_error . with_line ( 9 )
90
+
91
+ expect ( a ) . not_to eq ( b )
92
+ end
48
93
end
You can’t perform that action at this time.
0 commit comments