Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 204 lines (167 sloc) 3.536 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
# Test Comment Highlighting
# This file tests vim syntax highlighting. Sadly I can't actually automate
# this test so I must make a visual appraisal.

require: "test_require_keyword_highlight"

TEST_CONSTANT_HIGHLIGHTING = 1

class TestLiteralSyntaxHighlighting {
  def test_string_no_interp_highlighting {
    "test string with embedded escaped \" double quote"
  }

  def test_string_with_interpolation {
    "Sixty-four modulo three: #{64 % 3}"
  }

  def test_heredoc_highlighting {
    """
This is a heredocument
"""
  }

  def test_symbol_highlighting {
    'foobar
    'FO_O
    'FO%O
    'FO^O
    'FO&O
    'FO*O
    'FO-O
    'FO+O
    'FO=O
    'FO:O
    'FO|O
    'FO<O
    'FO>O
    'FO[O
    'FO]O
    'FO?O
    'FO!O
    'FO~O
    'FOO%^&*-+=:|<>[]?!~
  }

  def test_integer_highlighting {
    121
  }

  def test_negative_integer_highlighting {
    -9
  }

  def test_float_highlighting {
    1.61803

  def test_negative_float_highlighting {
    -0.000001
  }

class TestKeywordSyntaxHighlighting {
  def test_error_keywords_highlighting {
    try {
     'code
    } catch {
      'bar
      retry
    } finally {
    }
  }

  def test_return_keyword_highlighting {
    return
  }

  def test_return_local_keyword_highlighting {
    return_local
  }

  def test_match_case_stab_keyword_highlighting: value {
    match value {
      case true -> "win"
      case false -> "lose"
    }
  }

  def test_hashrocket_keyword_highlighting {
    <[ 'foo => 'bar ]>
  }

  def test_regexp_highlighting {
    /https?:(?:www)?\/\/\.google\.(com|co\.uk|hk|de)/
    /foobar(baz|qux)[-0-9]{1,2}\\\//ixmo
    /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/
  }
}

class TestVariableSyntaxHighlighting
  def test_true_and_false {
    true || false
  }

  def test_nil_highlighting {
    nil
  }

  def test_self_keyword_highlighting {
    self
  }

  def test_super_keyword_highlighting {
    super
  }

  def test_conditional_message_highlighting {
    if: true then: { 'win } else: { 'lose }
    unless: 'crime then: { 'free } else: { 'jail }
    true if_true: { "Violence" }
    false if_false: { "Peace" }
  }

  def test_loop_message_highlighting {
    done = false
    business = 'unfinished

    until: done do: {
      "workin'" println
      done = true
    }

    while: business == 'unfinished do: {
      "Finish this" println
      business = 'finished
    }

    loop: { "Non!" raise! }
  }

  def test_class_slot_highlighting {
    "Each slot should be highlighted."

    @@classapple
    @@class_apple
    @@class%apple
    @@class^apple
    @@class&apple
    @@class*apple
    @@class-apple
    @@class+apple
    @@class=apple
    @@class<apple
    @@class>apple
    @@class?apple
    @@class!apple
    @@class~apple
    @@class%^&*-+=<>?!~apple
  }

  def test_slot_highlighting {
    "Each slot should be highlighted."

    @apple
    @ap_ple
    @ap%ple
    @ap^ple
    @ap&ple
    @ap*ple
    @ap-ple
    @ap+ple
    @ap=ple
    @ap<ple
    @ap>ple
    @ap?ple
    @ap!ple
    @ap~ple
    @ap%^&*-+=<>?!~ple
  }

  def test_block_variable_highlighting {
    "|x,y| should be highlighted."

    true if_true: |x y| { x + y }
  }

  def test_dynamic_variable_highlighting {
    "The three dynamic variables should be highlighted."

    *stdout*
    *stdin*
    *stderr*
    *foo*
    *bar1_foo_233121*
  }

  def test_message_send_highlighting {
    "let:, be: and println should be highlighted one way and output another."

    let: output be: *stdout* do: {
      "I am a sorry tomato" println
    }
  }
}

Something went wrong with that request. Please try again.