File: token_spec.rb

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (20 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8 -*- #
# frozen_string_literal: true

describe Rouge::Token do
  it 'has a name' do
    assert { Rouge::Token['Text'].qualname == 'Text' }
    assert { Rouge::Token['Literal.String'].qualname == 'Literal.String' }
  end

  it 'has shortnames' do
    assert { Rouge::Token['Name'].shortname == 'n' }
    assert { Rouge::Token['Literal.String.Backtick'].shortname == 'sb' }
  end

  it 'calculates ancestors' do
    chain = Rouge::Token['Literal.String.Backtick'].token_chain.map(&:qualname)

    assert { chain == %w(Literal Literal.String Literal.String.Backtick) }
  end
end