• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

i-net-software / jlessc / 281

pending completion
281

push

travis-ci-com

volker
Handle doubled rule correctly in the compressed formatter if previous
rule ends with an block

5 of 5 new or added lines in 1 file covered. (100.0%)

3586 of 3873 relevant lines covered (92.59%)

2.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.0
/src/com/inet/lib/less/JavaScriptContext.java
1
/**
2
 * MIT License (MIT)
3
 *
4
 * Copyright (c) 2015 Volker Berlin
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 * 
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
15
 * 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * UT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
 * THE SOFTWARE.
23
 *
24
 * @author Volker Berlin
25
 * @license: The MIT license <http://opensource.org/licenses/MIT>
26
 */
27
package com.inet.lib.less;
28

29
import java.util.HashMap;
30

31
import javax.script.SimpleScriptContext;
32

33
/**
34
 * A ScriptContext for executing a JavaScript expression.
35
 */
36
class JavaScriptContext extends SimpleScriptContext {
37

38
    private final JavaScriptExpression    expr;
39

40
    private final HashMap<String, Object> attributes = new HashMap<>();
3✔
41

42
    /**
43
     * Create a new instance.
44
     * @param formatter the formatter with a reference to the variables of the current scope
45
     * @param expr the JavaScript expression
46
     */
47
    JavaScriptContext( CssFormatter formatter, JavaScriptExpression expr ) {
3✔
48
        this.expr = expr;
3✔
49
        engineScope = new JavaScriptBindings( formatter );
3✔
50
    }
3✔
51

52
    /**
53
     * {@inheritDoc}
54
     */
55
    @Override
56
    public Object getAttribute( String name ) {
57
        switch( name ) {
3✔
58
            case "javax.script.filename":
59
                return expr.getFileName();
3✔
60
        }
61
        return attributes.get( name );
×
62
    }
63

64
    /**
65
     * {@inheritDoc}
66
     */
67
    @Override
68
    public void setAttribute( String name, Object value, int scope ) {
69
        attributes.put( name, value );
×
70
    }
×
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc