From 10966535cb924b4fb1fbcee3d24b50410664cbfa Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 31 May 2024 20:54:24 +0000 Subject: [PATCH] [components] For https://github.com/mozilla-mobile/android-components/issues/191 - Adds JSON parsers UltraBlame original commit: 874d8a6147ff8a2bb785249a51af2b7d7b009598 --- .../browser/search/SearchSuggestionClient.kt | 20 +- .../browser/search/parser/SuggestionParser.kt | 216 +- .../search/SearchSuggestionClientTest.kt | 100 +- .../search/parser/SuggestionParserTest.kt | 3660 ++++++++++++++++- 4 files changed, 3924 insertions(+), 72 deletions(-) diff --git a/mobile/android/android-components/components/browser/search/src/main/java/mozilla/components/browser/search/SearchSuggestionClient.kt b/mobile/android/android-components/components/browser/search/src/main/java/mozilla/components/browser/search/SearchSuggestionClient.kt index f971a20a7fcb9..2ce2e065e599a 100644 --- a/mobile/android/android-components/components/browser/search/src/main/java/mozilla/components/browser/search/SearchSuggestionClient.kt +++ b/mobile/android/android-components/components/browser/search/src/main/java/mozilla/components/browser/search/SearchSuggestionClient.kt @@ -7,22 +7,6 @@ browser . search import -kotlinx -. -coroutines -. -experimental -. -async -import -kotlinx -. -coroutines -. -experimental -. -Deferred -import mozilla . components @@ -33,7 +17,7 @@ search . parser . -googleParser +defaultParser typealias SearchSuggestionFetcher = @@ -99,7 +83,7 @@ suggestionsURL . let { -googleParser +defaultParser ( it ) diff --git a/mobile/android/android-components/components/browser/search/src/main/java/mozilla/components/browser/search/parser/SuggestionParser.kt b/mobile/android/android-components/components/browser/search/src/main/java/mozilla/components/browser/search/parser/SuggestionParser.kt index 2b5fae5809408..0dcd72e16cb6e 100644 --- a/mobile/android/android-components/components/browser/search/src/main/java/mozilla/components/browser/search/parser/SuggestionParser.kt +++ b/mobile/android/android-components/components/browser/search/src/main/java/mozilla/components/browser/search/parser/SuggestionParser.kt @@ -9,11 +9,28 @@ search . parser import +mozilla +. +components +. +browser +. +search +. +SearchEngine +import org . json . JSONArray +import +org +. +json +. +JSONObject +private fun JSONArray . @@ -115,11 +132,18 @@ List < String > -val -googleParser +private +fun +fromArrayResult +( +resultsIndex +: +Int +) : Parser -= +{ +return { input - @@ -131,7 +155,7 @@ input . getJSONArray ( -1 +resultsIndex ) . asSequence @@ -154,3 +178,187 @@ toList ( ) } +} +private +fun +fromObjectResult +( +resultsKey +: +String +) +: +Parser +{ +return +{ +input +- +> +JSONObject +( +input +) +. +getJSONArray +( +resultsKey +) +. +asSequence +( +) +. +map +{ +it +as +? +String +} +. +filterNotNull +( +) +. +toList +( +) +} +} +private +fun +qwantParserBuilder +( +) +: +Parser +{ +return +{ +input +- +> +JSONObject +( +input +) +. +getJSONObject +( +" +data +" +) +. +getJSONArray +( +" +items +" +) +. +asSequence +( +) +. +map +{ +it +as +? +JSONObject +} +. +map +{ +it +? +. +getString +( +" +value +" +) +} +. +filterNotNull +( +) +. +toList +( +) +} +} +val +defaultParser += +fromArrayResult +( +1 +) +val +azerdictParser += +fromObjectResult +( +" +suggestions +" +) +val +daumParser += +fromObjectResult +( +" +items +" +) +val +qwantParser += +qwantParserBuilder +( +) +fun +selectParser +( +searchEngine +: +SearchEngine +) +: +Parser += +when +( +searchEngine +. +name +) +{ +" +Azerdict +" +- +> +azerdictParser +" +" +- +> +daumParser +" +Qwant +" +- +> +qwantParser +else +- +> +defaultParser +} diff --git a/mobile/android/android-components/components/browser/search/src/test/java/mozilla/components/browser/search/SearchSuggestionClientTest.kt b/mobile/android/android-components/components/browser/search/src/test/java/mozilla/components/browser/search/SearchSuggestionClientTest.kt index 0054ac6ca1077..fc749db7a4d00 100644 --- a/mobile/android/android-components/components/browser/search/src/test/java/mozilla/components/browser/search/SearchSuggestionClientTest.kt +++ b/mobile/android/android-components/components/browser/search/src/test/java/mozilla/components/browser/search/SearchSuggestionClientTest.kt @@ -122,54 +122,14 @@ class class SearchSuggestionClientTest { -Test -fun -Get -a -list -of -results -based -on -a -search -engine -( -) +companion +object { val -searchEngine -= -SearchEngineParser -( -) -. -load -( -RuntimeEnvironment -. -application -. -assets -" -google -" -" -searchplugins -/ -google -- -nocodes -. -xml -" -) -val -client +GOOGLE_MOCK +: +SearchSuggestionFetcher = -SearchSuggestionClient -( -searchEngine { " [ @@ -244,6 +204,56 @@ cache ] " } +} +Test +fun +Get +a +list +of +results +based +on +a +search +engine +( +) +{ +val +searchEngine += +SearchEngineParser +( +) +. +load +( +RuntimeEnvironment +. +application +. +assets +" +google +" +" +searchplugins +/ +google +- +nocodes +. +xml +" +) +val +client += +SearchSuggestionClient +( +searchEngine +GOOGLE_MOCK ) runBlocking { diff --git a/mobile/android/android-components/components/browser/search/src/test/java/mozilla/components/browser/search/parser/SuggestionParserTest.kt b/mobile/android/android-components/components/browser/search/src/test/java/mozilla/components/browser/search/parser/SuggestionParserTest.kt index ecce5f0fa0649..b16a539c0c9f8 100644 --- a/mobile/android/android-components/components/browser/search/src/test/java/mozilla/components/browser/search/parser/SuggestionParserTest.kt +++ b/mobile/android/android-components/components/browser/search/src/test/java/mozilla/components/browser/search/parser/SuggestionParserTest.kt @@ -106,11 +106,12 @@ SuggestionParserTest { Test fun -Parse +can +parse a -search -suggestion -result +response +from +Google ( ) { @@ -192,7 +193,7 @@ cache val results = -googleParser +defaultParser ( json ) @@ -249,4 +250,3653 @@ expectedResults results ) } +Test +fun +can +parse +a +response +from +Amazon +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +for +fire +tv +\ +" +\ +" +firefox +movie +\ +" +\ +" +firefox +app +\ +" +\ +" +firefox +books +\ +" +\ +" +firefox +glider +\ +" +\ +" +firefox +stick +\ +" +\ +" +firefox +for +firestick +\ +" +\ +" +firefox +\ +" +\ +" +firefox +books +series +\ +" +\ +" +firefox +browser +\ +" +] +[ +{ +\ +" +nodes +\ +" +: +[ +{ +\ +" +name +\ +" +: +\ +" +Apps +& +Games +\ +" +\ +" +alias +\ +" +: +\ +" +mobile +- +apps +\ +" +} +] +} +{ +} +{ +} +{ +} +{ +} +{ +} +{ +} +{ +} +{ +} +{ +} +] +[ +] +\ +" +344I6KZL0KU9N +\ +" +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +for +fire +tv +" +" +firefox +movie +" +" +firefox +app +" +" +firefox +books +" +" +firefox +glider +" +" +firefox +stick +" +" +firefox +for +firestick +" +" +firefox +" +" +firefox +books +series +" +" +firefox +browser +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Azerdict +( +) +{ +val +json += +" +{ +\ +" +query +\ +" +: +\ +" +code +\ +" +\ +" +suggestions +\ +" +: +[ +\ +" +code +\ +" +\ +" +codec +\ +" +\ +" +codex +\ +" +\ +" +codeine +\ +" +\ +" +code +of +laws +\ +" +] +} +" +val +results += +azerdictParser +( +json +) +val +expectedResults += +listOf +( +" +code +" +" +codec +" +" +codex +" +" +codeine +" +" +code +of +laws +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Baidu +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +rocket +\ +" +\ +" +firefox +\ +" +\ +" +firefox +\ +" +\ +" +firefox +focus +\ +" +\ +" +firefox +\ +" +\ +" +firefox +\ +" +\ +" +firefox +\ +" +\ +" +firefox +os +\ +" +\ +" +firefox +\ +" +\ +" +firefox +android +\ +" +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +rocket +" +" +firefox +" +" +firefox +" +" +firefox +focus +" +" +firefox +" +" +firefox +" +" +firefox +" +" +firefox +os +" +" +firefox +" +" +firefox +android +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Bing +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +\ +" +\ +" +firefox +download +\ +" +\ +" +firefox +for +windows +10 +\ +" +\ +" +firefox +browser +\ +" +\ +" +firefox +quantum +\ +" +\ +" +firefox +esr +\ +" +\ +" +firefox +64 +- +bit +\ +" +\ +" +firefox +mozilla +\ +" +\ +" +firefox +nightly +\ +" +\ +" +firefox +update +\ +" +\ +" +firefox +install +\ +" +\ +" +firefox +focus +\ +" +\ +" +firefox +beta +\ +" +\ +" +firefox +developer +edition +\ +" +\ +" +firefox +portable +\ +" +\ +" +firefox +add +- +ons +\ +" +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +" +" +firefox +download +" +" +firefox +for +windows +10 +" +" +firefox +browser +" +" +firefox +quantum +" +" +firefox +esr +" +" +firefox +64 +- +bit +" +" +firefox +mozilla +" +" +firefox +nightly +" +" +firefox +update +" +" +firefox +install +" +" +firefox +focus +" +" +firefox +beta +" +" +firefox +developer +edition +" +" +firefox +portable +" +" +firefox +add +- +ons +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Coccoc +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +\ +" +\ +" +firefox +ti +ng +vi +t +\ +" +\ +" +firefox +download +\ +" +\ +" +firefox +quantum +\ +" +\ +" +firefox +51 +\ +" +\ +" +firefox +42 +\ +" +\ +" +firefox +english +\ +" +\ +" +firefox +portable +\ +" +\ +" +firefox +49 +\ +" +\ +" +firefox +viet +nam +\ +" +] +[ +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +] +[ +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +\ +" +] +{ +\ +" +google +: +suggesttype +\ +" +: +[ +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +\ +" +QUERY +\ +" +] +} +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +" +" +firefox +ti +ng +vi +t +" +" +firefox +download +" +" +firefox +quantum +" +" +firefox +51 +" +" +firefox +42 +" +" +firefox +english +" +" +firefox +portable +" +" +firefox +49 +" +" +firefox +viet +nam +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Daum +( +) +{ +val +json += +" +{ +\ +" +q +\ +" +: +\ +" +firefox +\ +" +\ +" +rq +\ +" +: +\ +" +firefox +\ +" +\ +" +items +\ +" +: +[ +\ +" +firefox +\ +" +\ +" +firefox +download +\ +" +\ +" +firefox +focus +\ +" +\ +" +mozilla +firefox +\ +" +\ +" +firefox +adobe +flash +\ +" +\ +" +firefox +\ +" +\ +" +firefox +\ +" +\ +" +firefox +\ +" +\ +" +firefox +quantum +\ +" +\ +" +firefox +57 +\ +" +\ +" +mozila +firefox +\ +" +\ +" +mozilla +firefox +download +\ +" +\ +" +mozilla +firefox +\ +" +\ +" +Hacking +Firefox +\ +" +\ +" +Programming +Firefox +\ +" +] +\ +" +r_items +\ +" +: +[ +] +} +" +val +results += +daumParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +" +" +firefox +download +" +" +firefox +focus +" +" +mozilla +firefox +" +" +firefox +adobe +flash +" +" +firefox +" +" +firefox +" +" +firefox +" +" +firefox +quantum +" +" +firefox +57 +" +" +mozila +firefox +" +" +mozilla +firefox +download +" +" +mozilla +firefox +" +" +Hacking +Firefox +" +" +Programming +Firefox +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Duck +Duck +Go +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +\ +" +\ +" +firefox +browser +\ +" +\ +" +firefox +. +com +\ +" +\ +" +firefox +update +\ +" +\ +" +firefox +for +mac +\ +" +\ +" +firefox +quantum +\ +" +\ +" +firefox +extensions +\ +" +\ +" +firefox +esr +\ +" +\ +" +firefox +clear +cache +\ +" +\ +" +firefox +themes +\ +" +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +" +" +firefox +browser +" +" +firefox +. +com +" +" +firefox +update +" +" +firefox +for +mac +" +" +firefox +quantum +" +" +firefox +extensions +" +" +firefox +esr +" +" +firefox +clear +cache +" +" +firefox +themes +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Naver +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +\ +" +\ +" +Mozilla +Firefox +\ +" +\ +" +firefox +add +- +on +to +detect +vulnerable +websites +\ +" +\ +" +firefox +ak +\ +" +\ +" +firefox +as +gaeilge +\ +" +\ +" +firefox +developer +edition +\ +" +\ +" +firefox +down +\ +" +\ +" +firefox +for +dummies +\ +" +\ +" +firefox +for +mac +\ +" +\ +" +firefox +for +mobile +\ +" +] +[ +] +[ +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +Mozilla ++ +Firefox +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox ++ +add +- +on ++ +to ++ +detect ++ +vulnerable ++ +websites +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox ++ +ak +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox ++ +as ++ +gaeilge +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox ++ +developer ++ +edition +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox ++ +down +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox ++ +for ++ +dummies +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox ++ +for ++ +mac +\ +" +\ +" +http +: +/ +/ +search +. +naver +. +com +/ +search +. +naver +? +where += +nexearch +& +sm += +osp_sug +& +ie += +utf8 +& +query += +firefox ++ +for ++ +mobile +\ +" +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +" +" +Mozilla +Firefox +" +" +firefox +add +- +on +to +detect +vulnerable +websites +" +" +firefox +ak +" +" +firefox +as +gaeilge +" +" +firefox +developer +edition +" +" +firefox +down +" +" +firefox +for +dummies +" +" +firefox +for +mac +" +" +firefox +for +mobile +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Prisjakt +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +Firefox +\ +" +\ +" +Firefox +\ +" +\ +" +Mountain +Equipment +Firefox +Pants +( +Herr +) +\ +" +\ +" +Mountain +Equipment +Firefox +( +Herr +) +\ +" +\ +" +Firefox +( +DE +) +\ +" +] +[ +\ +" +L +\ +\ +u00e4gsta +pris +: +149 +: +- +\ +" +\ +" +L +\ +\ +u00e4gsta +pris +: +205 +: +- +\ +" +\ +" +L +\ +\ +u00e4gsta +pris +: +1 +559 +: +- +\ +" +\ +" +L +\ +\ +u00e4gsta +pris +: +2 +773 +: +- +\ +" +\ +" +L +\ +\ +u00e4gsta +pris +: +198 +: +- +\ +" +] +[ +\ +" +https +: +\ +\ +/ +\ +\ +/ +www +. +prisjakt +. +nu +\ +\ +/ +produkt +. +php +? +p += +886794 +\ +" +\ +" +https +: +\ +\ +/ +\ +\ +/ +www +. +prisjakt +. +nu +\ +\ +/ +produkt +. +php +? +p += +53272 +\ +" +\ +" +https +: +\ +\ +/ +\ +\ +/ +www +. +prisjakt +. +nu +\ +\ +/ +produkt +. +php +? +p += +3548472 +\ +" +\ +" +https +: +\ +\ +/ +\ +\ +/ +www +. +prisjakt +. +nu +\ +\ +/ +produkt +. +php +? +p += +1822581 +\ +" +\ +" +https +: +\ +\ +/ +\ +\ +/ +www +. +prisjakt +. +nu +\ +\ +/ +produkt +. +php +? +p += +3408551 +\ +" +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +Firefox +" +" +Firefox +" +" +Mountain +Equipment +Firefox +Pants +( +Herr +) +" +" +Mountain +Equipment +Firefox +( +Herr +) +" +" +Firefox +( +DE +) +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Qwant +( +) +{ +val +json += +" +{ +\ +" +status +\ +" +: +\ +" +success +\ +" +\ +" +data +\ +" +: +{ +\ +" +items +\ +" +: +[ +{ +\ +" +value +\ +" +: +\ +" +firefox +( +video +game +) +\ +" +\ +" +suggestType +\ +" +: +3 +} +{ +\ +" +value +\ +" +: +\ +" +firefox +addons +\ +" +\ +" +suggestType +\ +" +: +12 +} +{ +\ +" +value +\ +" +: +\ +" +firefox +\ +" +\ +" +suggestType +\ +" +: +2 +} +{ +\ +" +value +\ +" +: +\ +" +firefox +quantum +\ +" +\ +" +suggestType +\ +" +: +12 +} +{ +\ +" +value +\ +" +: +\ +" +firefox +focus +\ +" +\ +" +suggestType +\ +" +: +12 +} +] +\ +" +special +\ +" +: +[ +] +\ +" +availableQwick +\ +" +: +[ +] +} +} +" +val +results += +qwantParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +( +video +game +) +" +" +firefox +addons +" +" +firefox +" +" +firefox +quantum +" +" +firefox +focus +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Seznam +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +\ +" +\ +" +firefox +ak +keep +it +up +\ +" +\ +" +firefox +ak +city +to +city +\ +" +\ +" +firefox +ak +all +those +people +\ +" +\ +" +firefox +ak +who +can +act +\ +" +\ +" +firefox +ak +color +the +trees +\ +" +\ +" +firefox +ak +habibi +\ +" +\ +" +firefox +ak +zodiac +\ +" +\ +" +firefox +ak +the +draft +\ +" +\ +" +mozilla +firefox +\ +" +] +[ +] +[ +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +" +" +firefox +ak +keep +it +up +" +" +firefox +ak +city +to +city +" +" +firefox +ak +all +those +people +" +" +firefox +ak +who +can +act +" +" +firefox +ak +color +the +trees +" +" +firefox +ak +habibi +" +" +firefox +ak +zodiac +" +" +firefox +ak +the +draft +" +" +mozilla +firefox +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Wikipedia +( +) +{ +val +json += +" +[ +\ +" +code +\ +" +[ +\ +" +Code +\ +" +\ +" +Code +Geass +\ +" +\ +" +Codeine +\ +" +\ +" +Codename +: +Kids +Next +Door +\ +" +\ +" +Code +page +\ +" +\ +" +Codex +Sinaiticus +\ +" +\ +" +Code +talker +\ +" +\ +" +Code +Black +( +TV +series +) +\ +" +\ +" +Codependency +\ +" +\ +" +Codex +Vaticanus +\ +" +] +[ +\ +" +In +communications +and +information +processing +code +is +a +system +of +rules +to +convert +information +\ +\ +u2014such +as +a +letter +word +sound +image +or +gesture +\ +\ +u2014into +another +form +or +representation +sometimes +shortened +or +secret +for +communication +through +a +communication +channel +or +storage +in +a +storage +medium +. +\ +" +\ +" +Code +Geass +: +Lelouch +of +the +Rebellion +( +\ +\ +u30b3 +\ +\ +u30fc +\ +\ +u30c9 +\ +\ +u30ae +\ +\ +u30a2 +\ +\ +u30b9 +\ +\ +u53cd +\ +\ +u9006 +\ +\ +u306e +\ +\ +u30eb +\ +\ +u30eb +\ +\ +u30fc +\ +\ +u30b7 +\ +\ +u30e5 +K +\ +\ +u014ddo +Giasu +: +Hangyaku +no +Rur +\ +\ +u016bshu +) +often +referred +to +as +simply +Code +Geass +is +a +Japanese +anime +series +created +by +Sunrise +directed +by +Gor +\ +\ +u014d +Taniguchi +and +written +by +Ichir +\ +\ +u014d +\ +\ +u014ckouchi +with +original +character +designs +by +manga +authors +Clamp +. +\ +" +\ +" +Codeine +is +an +opiate +used +to +treat +pain +as +a +cough +medicine +and +for +diarrhea +. +It +is +typically +used +to +treat +mild +to +moderate +degrees +of +pain +. +\ +" +\ +" +Codename +: +Kids +Next +Door +commonly +abbreviated +to +Kids +Next +Door +or +KND +is +an +American +animated +television +series +created +by +Tom +Warburton +for +Cartoon +Network +and +the +13th +of +the +network +' +s +Cartoon +Cartoons +. +\ +" +\ +" +In +computing +a +code +page +is +a +table +of +values +that +describes +the +character +set +used +for +encoding +a +particular +set +of +characters +usually +combined +with +a +number +of +control +characters +. +\ +" +\ +" +Codex +Sinaiticus +( +Greek +: +\ +\ +u03a3 +\ +\ +u03b9 +\ +\ +u03bd +\ +\ +u03b1 +\ +\ +u03ca +\ +\ +u03c4 +\ +\ +u03b9 +\ +\ +u03ba +\ +\ +u03cc +\ +\ +u03c2 +\ +\ +u039a +\ +\ +u03ce +\ +\ +u03b4 +\ +\ +u03b9 +\ +\ +u03ba +\ +\ +u03b1 +\ +\ +u03c2 +Hebrew +: +\ +\ +u05e7 +\ +\ +u05d5 +\ +\ +u05d3 +\ +\ +u05e7 +\ +\ +u05e1 +\ +\ +u05e1 +\ +\ +u05d9 +\ +\ +u05e0 +\ +\ +u05d0 +\ +\ +u05d9 +\ +\ +u05d8 +\ +\ +u05d9 +\ +\ +u05e7 +\ +\ +u05d5 +\ +\ +u05e1 +\ +\ +u200e +; +Shelfmarks +and +references +: +London +Brit +. +\ +" +\ +" +Code +talkers +are +people +in +the +20th +century +who +used +obscure +languages +as +a +means +of +secret +communication +during +wartime +. +\ +" +\ +" +Code +Black +is +an +American +medical +drama +television +series +created +by +Michael +Seitzman +which +premiered +on +CBS +on +September +30 +2015 +. +It +takes +place +in +an +overcrowded +and +understaffed +emergency +room +in +Los +Angeles +California +and +is +based +on +a +documentary +by +Ryan +McGarry +. +\ +" +\ +" +Codependency +is +a +controversial +concept +for +a +dysfunctional +helping +relationship +where +one +person +supports +or +enables +another +person +' +s +addiction +poor +mental +health +immaturity +irresponsibility +or +under +- +achievement +. +\ +" +\ +" +The +Codex +Vaticanus +( +The +Vatican +Bibl +. +Vat +. +Vat +. +gr +. +1209 +; +no +. +B +or +03 +Gregory +- +Aland +\ +\ +u03b4 +1 +von +Soden +) +is +regarded +as +the +oldest +extant +manuscript +of +the +Greek +Bible +( +Old +and +New +Testament +) +one +of +the +four +great +uncial +codices +. +\ +" +] +[ +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Code +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Code_Geass +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Codeine +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Codename +: +_Kids_Next_Door +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Code_page +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Codex_Sinaiticus +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Code_talker +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Code_Black_ +( +TV_series +) +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Codependency +\ +" +\ +" +https +: +/ +/ +en +. +wikipedia +. +org +/ +wiki +/ +Codex_Vaticanus +\ +" +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +Code +" +" +Code +Geass +" +" +Codeine +" +" +Codename +: +Kids +Next +Door +" +" +Code +page +" +" +Codex +Sinaiticus +" +" +Code +talker +" +" +Code +Black +( +TV +series +) +" +" +Codependency +" +" +Codex +Vaticanus +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Yahoo +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +\ +" +\ +" +firefox +browser +\ +" +\ +" +firefox +. +com +\ +" +\ +" +firefox +update +\ +" +] +[ +] +[ +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +" +" +firefox +browser +" +" +firefox +. +com +" +" +firefox +update +" +) +assertEquals +( +expectedResults +results +) +} +Test +fun +can +parse +a +response +from +Yandex +( +) +{ +val +json += +" +[ +\ +" +firefox +\ +" +[ +\ +" +firefox +\ +" +\ +" +firefox +download +\ +" +\ +" +firefox +browser +\ +" +\ +" +firefox +update +\ +" +\ +" +firefox +. +com +\ +" +] +] +" +val +results += +defaultParser +( +json +) +val +expectedResults += +listOf +( +" +firefox +" +" +firefox +download +" +" +firefox +browser +" +" +firefox +update +" +" +firefox +. +com +" +) +assertEquals +( +expectedResults +results +) +} }