mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
Merge branch 'master' of https://github.com/i-net-software/JWebAssembly.git
This commit is contained in:
commit
f61a994d40
@ -77,7 +77,9 @@ public class SourceMapWriter {
|
||||
|
||||
// sourceRoot
|
||||
if( sourceRoot != null && !sourceRoot.isEmpty() ) {
|
||||
appendJsonField( out, "sourceRoot", sourceRoot );
|
||||
out.append( ",\n" );
|
||||
appendJsonField( out, "sourceRoot", "" );
|
||||
appendQuoteString( out, sourceRoot );
|
||||
}
|
||||
|
||||
// the source file names
|
||||
|
@ -27,4 +27,25 @@ public class SourceMapWriterTest {
|
||||
"}";
|
||||
assertEquals( expected, generate.toString() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sourceRootNotNull() throws IOException {
|
||||
SourceMapWriter map = new SourceMapWriter( "../../src/main/java/" );
|
||||
|
||||
map.addMapping( new SourceMapping( 0, 1, "Test1.java" ) );
|
||||
map.addMapping( new SourceMapping( 5, 2, "Test1.java" ) );
|
||||
map.addMapping( new SourceMapping( 0, 4, "Test2.java" ) );
|
||||
map.addMapping( new SourceMapping( 5, 9, "Test2.java" ) );
|
||||
|
||||
StringBuilder generate = new StringBuilder();
|
||||
map.generate( generate );
|
||||
String expected = "{\n" +
|
||||
"\"version\":3,\n" +
|
||||
"\"sourceRoot\":\"../../src/main/java/\",\n" +
|
||||
"\"sources\":[\"Test1.java\",\"Test2.java\"],\n" +
|
||||
"\"names\":[],\n" +
|
||||
"\"mappings\":\"AAAA,KACA,LCEA,KAKA;\"\n" +
|
||||
"}";
|
||||
assertEquals( expected, generate.toString() );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user