/* Ċ Ġ* ĠCopyright Ġ 2 0 0 0 - 2 0 1 6 ĠJetBrains Ġs . r . o . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . intellij . formatting Ċ Ċ import Ġcom . intellij . openapi . util . Text Range Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Test Ċ Ċ class ĠFormat Text Range Test Ġ{ ĊĠĠĊĠ Ġ@ Test ĊĠ Ġfun Ġ` without Ġheading Ġspace `() Ġ{ ĊĠĠĠ Ġ// equal Ġ( start Offset , Ġend Offset ) ĊĠĠĠ Ġval Ġranges Ġ= Ġnew Format Ranges ( 5 , Ġ 6 , Ġfalse ) ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 4 , Ġ 5 ))). isTrue () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 6 , Ġ 7 ))). isTrue () ĊĠ Ġ} ĊĠĠĊĠ Ġ@ Test ĊĠ Ġfun Ġ` with Ġheading Ġspace `() Ġ{ ĊĠĠĠ Ġ// equal Ġ[ start Offset , Ġend Offset ) ĊĠĠĠ Ġval Ġranges Ġ= Ġnew Format Ranges ( 5 , Ġ 6 , Ġtrue ) ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 4 , Ġ 5 ))). isFalse () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 6 , Ġ 7 ))). isTrue () ĊĠ Ġ} ĊĠĠĊĠ Ġ@ Test ĊĠ Ġfun Ġ` check Ġprocess Heading Space Ġdifference Ġat Ġstart Ġoffset `() Ġ{ ĊĠĠĠ Ġval Ġno Heading Space Ġ= Ġnew Format Ranges ( 5 , Ġ 6 , Ġfalse ) ĊĠĠĠ ĠassertThat ( no Heading Space . is Whitespace ReadOnly ( Text Range ( 0 , Ġ 5 ))). isTrue () ĊĊĠĠĠ Ġval Ġwith Heading Space Ġ= Ġnew Format Ranges ( 5 , Ġ 6 , Ġtrue ) ĊĠĠĠ ĠassertThat ( with Heading Space . is Whitespace ReadOnly ( Text Range ( 0 , Ġ 5 ))). isFalse () ĊĠ Ġ} ĊĠĠĊĠ Ġ@ Test ĊĠ Ġfun Ġ` check Ġprocess Heading Space Ġdifference Ġat Ġend Ġoffset `() Ġ{ ĊĠĠĠ Ġval Ġno Heading Space Ġ= Ġnew Format Ranges ( 5 , Ġ 6 , Ġfalse ) ĊĠĠĠ ĠassertThat ( no Heading Space . is Whitespace ReadOnly ( Text Range ( 6 , Ġ 7 ))). isTrue () ĊĊĠĠĠ Ġval Ġwith Heading Space Ġ= Ġnew Format Ranges ( 5 , Ġ 6 , Ġtrue ) ĊĠĠĠ ĠassertThat ( with Heading Space . is Whitespace ReadOnly ( Text Range ( 6 , Ġ 7 ))). isTrue () ĊĠ Ġ} ĊĠĠĊĠ Ġ@ Test ĊĠ Ġfun Ġ` check Ġis Whitespace ReadOnly Ġno Ġheading Ġspace `() Ġ{ ĊĠĠĠ Ġval Ġranges Ġ= Ġnew Format Ranges ( 1 0 , Ġ 3 0 , Ġfalse ) ĊĠĠĠĠĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 0 , Ġ 1 0 ))). isTrue () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 0 , Ġ 1 1 ))). isFalse () ĊĠĠĠĠĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 2 9 , Ġ 3 0 ))). isFalse () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 3 0 , Ġ 4 0 ))). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` check Ġis Whitespace ReadOnly Ġwith Ġheading Ġspace `() Ġ{ ĊĠĠĠ Ġval Ġranges Ġ= Ġnew Format Ranges ( 1 0 , Ġ 3 0 , Ġtrue ) ĊĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 0 , Ġ 9 ))). isTrue () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 3 1 , Ġ 4 0 ))). isTrue () ĊĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 9 , Ġ 1 0 ))). isFalse () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 3 0 , Ġ 3 1 ))). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` check Ġpartial Ġintersection Ġno Ġheading Ġspace `() Ġ{ ĊĠĠĠ Ġval Ġranges Ġ= Ġnew Format Ranges ( 1 0 , Ġ 3 0 , Ġfalse ) ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 9 , Ġ 1 0 ))). isTrue () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 9 , Ġ 1 1 ))). isFalse () ĊĠĠĠĠĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 2 9 , Ġ 3 1 ))). isFalse () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 3 1 , Ġ 3 2 ))). isTrue () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` check Ġpartial Ġintersection Ġwith Ġheading Ġspace `() Ġ{ ĊĠĠĠ Ġval Ġranges Ġ= Ġnew Format Ranges ( 1 0 , Ġ 3 0 , Ġtrue ) ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 8 , Ġ 9 ))). isTrue () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 9 , Ġ 1 0 ))). isFalse () ĊĠĠĠĠĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 2 9 , Ġ 3 1 ))). isFalse () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 3 1 , Ġ 3 2 ))). isTrue () ĊĠ Ġ} ĊĠĠĊĠ Ġ@ Test ĊĠ Ġfun Ġ` check Ġcontains Ġno Ġheading Ġspace `() Ġ{ ĊĠĠĠ Ġval Ġranges Ġ= Ġnew Format Ranges ( 1 0 , Ġ 3 0 , Ġfalse ) ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 1 5 , Ġ 2 0 ))). isFalse () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 1 1 , Ġ 2 9 ))). isFalse () ĊĠĠĠ ĠassertThat ( ranges . is Whitespace ReadOnly ( Text Range ( 5 , Ġ 3 5 ))). isFalse () ĊĠ Ġ} ĊĠĠĊĠ Ġprivate Ġfun Ġnew Format Ranges ( start : ĠInt , Ġend : ĠInt , Ġprocess Heading Space : ĠBoolean Ġ= Ġfalse ): ĠFormat Text Ranges Ġ{ ĊĠĠĠ Ġreturn ĠFormat Text Ranges ( Text Range ( start , Ġend ), Ġprocess Heading Space ) ĊĠ Ġ} Ċ Ċ }