/* Ċ Ġ* ĠCopyright Ġ 2 0 0 0 - 2 0 1 9 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ Ġ*/ Ċ Ċ package Ġorg . jetbrains . r . completion Ċ Ċ import Ġjunit . framework . TestCase Ċ import Ġorg . jetbrains . r . RL ight Code Insight Fixture TestCase Ċ Ċ class ĠFilePath Completion Test Ġ: ĠR Light Code Insight Fixture TestCase () Ġ{ ĊĠ Ġfun Ġtest Completion () Ġ{ ĊĠĠĠ Ġcheck Completion ("\" < caret > \"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf (" aaa . txt ", Ġ" bbb . txt ", Ġ" ccc . kt "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf (" aaa . txt ", Ġ" bbb . txt ", Ġ" ccc . kt ")) ĊĠ Ġ} ĊĊĠ Ġfun Ġtest Dirs () Ġ{ ĊĠĠĠ Ġcheck Completion ("\" dir 1 /< caret > \"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf (" aa . txt ", Ġ" bb . txt ", Ġ" dir 1 / xy . java ", Ġ" dir 1 / yz . kt ", Ġ" dir 1 / zz / z . txt ", Ġ" dir 2 / abc . R "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf (" xy . java ", Ġ" yz . kt ", Ġ" zz ")) ĊĠ Ġ} ĊĊĠ Ġfun Ġtest In Source () Ġ{ ĊĠĠĠ Ġcheck Completion (" source (\" A < caret >\ ") ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf (" aa . R ", Ġ" A . R ", Ġ" A 1 . R ", Ġ" BA . R ", Ġ" B . R md "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf (" A . R ", Ġ" A 1 . R ", Ġ" BA . R ")) ĊĠ Ġ} ĊĊĠ Ġfun Ġtest AbsolutePath () Ġ{ ĊĠĠĠ Ġcheck Completion ("\" $ testData Path /< caret > \"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġempty List (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf (" absolute FilePath . R ")) ĊĠ Ġ} ĊĊĠ Ġfun Ġtest InThe Middle Of FileName () Ġ{ ĊĠĠĠ Ġmy Fixture . add File To Project (" my _ another _ file . r ", Ġ"") ĊĠĠĠ Ġmy Fixture . configure By Text (" current File . R ", Ġ"\" my _< caret > file . R \" ") ĊĠĠĠ Ġmy Fixture . complete Basic () ĊĠĠĠ Ġmy Fixture . finish Lookup ('\ n ') ĊĠĠĠ Ġmy Fixture . editor . document . text Ġ== Ġ"\" my _ another _ file . r file . R \"" ĊĠ Ġ} ĊĊĠ Ġfun Ġtest Invalid Path () Ġ{ ĊĠĠĠ Ġcheck Completion ("\" \\\\ 1 Ġ< Ġ\ \\\ 2 < caret > \"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġempty List (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġempty List ()) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcheck Completion ( text : ĠString , Ġfiles : ĠList < String >, Ġexpected : ĠList < String >) Ġ{ ĊĠĠĠ Ġmy Fixture . configure By Text (" current File . R ", Ġtext ) ĊĠĠĠ Ġfiles . forEach Ġ{ Ġmy Fixture . add File To Project ( it , Ġ"") Ġ} ĊĠĠĠ Ġval Ġresult Ġ= Ġmy Fixture . complete Basic () ĊĠĠĠ ĠTestCase . assertNotNull ( result ) ĊĠĠĠ Ġval Ġlookup Strings Ġ= Ġresult . map Ġ{ Ġit . lookup String Ġ}. filter Ġ{ Ġit Ġ!= Ġ" current File . R " Ġ} ĊĠĠĠ ĠTestCase . assertEquals ( expected , Ġlookup Strings ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġget TestData Path (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġsuper . get TestData Path () Ġ+ Ġ"/ filePath Completion " ĊĠ Ġ} Ċ }