@@ -27,14 +27,16 @@ public class LuaFileTest {
27
27
private static final String TRC_FILENAME = "sampleTrc.lua" ;
28
28
private static final String TRN_FILENAME = "sampleTrn.lua" ;
29
29
private static final String TRNC_FILENAME = "sampleTrnc.lua" ;
30
+ private static final String REASSIGN_FILENAME = "varReassign.lua" ;
31
+
30
32
private static final String COMMENT_FORMAT = "#." ;
31
33
private static final String FORCE_EXTRACT_FORMAT = "#!extract" ;
32
34
private static final String IGNORE_FORMAT = "#!ignore" ;
33
35
34
36
private static final String TR_CUSTOM_COMMENT_FILENAME = "sampleTrCustomComment.lua" ;
35
37
private static final String CUSTOM_COMMENT_FORMAT = " #. " ;
36
38
37
- private static LuaFile TR_FILE , TRC_FILE , TRN_FILE , TRNC_FILE , TR_CUSTOM_COMMENT_FILE ;
39
+ private static LuaFile TR_FILE , TRC_FILE , TRN_FILE , TRNC_FILE , TR_CUSTOM_COMMENT_FILE , REASSIGN_FILE ;
38
40
39
41
private final List <TranslationEntry > results = new ArrayList <TranslationEntry >();
40
42
@@ -51,6 +53,8 @@ public static void loadFiles() throws IOException {
51
53
COMMENT_FORMAT , FORCE_EXTRACT_FORMAT , IGNORE_FORMAT );
52
54
TR_CUSTOM_COMMENT_FILE = new LuaFile (LuaFileTest .class .getResourceAsStream ("/" + TR_CUSTOM_COMMENT_FILENAME ), TR_CUSTOM_COMMENT_FILENAME ,
53
55
CUSTOM_COMMENT_FORMAT , FORCE_EXTRACT_FORMAT , IGNORE_FORMAT );
56
+ REASSIGN_FILE = new LuaFile (LuaFileTest .class .getResourceAsStream ("/" + REASSIGN_FILENAME ), REASSIGN_FILENAME ,
57
+ COMMENT_FORMAT , FORCE_EXTRACT_FORMAT , IGNORE_FORMAT );
54
58
} catch (Exception e ) {
55
59
e .printStackTrace ();
56
60
}
@@ -247,4 +251,16 @@ public void testTrCustomComment() {
247
251
Assert .assertEquals (1 , entry3 .getExtractedComments ().size ());
248
252
Assert .assertEquals ("Comment 1" , entry3 .getExtractedComments ().get (0 ));
249
253
}
254
+
255
+ @ Test
256
+ public void testTrReassignVariable () {
257
+ REASSIGN_FILE .getTranslationEntries (results );
258
+
259
+ Assert .assertEquals (1 , results .size ());
260
+
261
+ final TranslationEntry entry0 = results .get (0 );
262
+ Assert .assertEquals (REASSIGN_FILENAME + ":3" , entry0 .getReference ());
263
+ Assert .assertEquals ("Re-assigned Ref" , entry0 .getId ());
264
+ Assert .assertEquals (0 , entry0 .getExtractedComments ().size ());
265
+ }
250
266
}
0 commit comments