Class: MarkdownExec::TestApplyOtherFilters

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/filter.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



324
325
326
327
# File 'lib/filter.rb', line 324

def setup
  @filters = {}
  @options = {}
end

#test_disable_block_when_match_foundObject



351
352
353
354
355
356
357
# File 'lib/filter.rb', line 351

def test_disable_block_when_match_found
  @options[:block_disable_match] = 'disable_this'
  fcb = FCB.new(oname: 'test', shell: ShellType::BASH,
                start_line: 'disable_this')
  Filter.apply_other_filters(@options, @filters, fcb)
  assert_equal TtyMenu::DISABLE, fcb.disabled
end

#test_fcb_chromeObject



329
330
331
332
333
334
# File 'lib/filter.rb', line 329

def test_fcb_chrome
  fcb = FCB.new(oname: 'test', shell: ShellType::BASH, start_line: '')
  fcb.chrome = true
  Filter.apply_other_filters(@options, @filters, fcb)
  assert_equal true, @filters[:fcb_chrome]
end

#test_hidden_block_by_nameObject



359
360
361
362
363
364
365
366
# File 'lib/filter.rb', line 359

def test_hidden_block_by_name
  @options[:block_name_hidden_match] = 'hidden_block'
  @options[:hide_blocks_by_name] = true
  fcb = FCB.new(oname: 'hidden_block', shell: ShellType::BASH,
                start_line: '')
  Filter.apply_other_filters(@options, @filters, fcb)
  assert_equal true, @filters[:hidden_name]
end

#test_include_block_by_nameObject



368
369
370
371
372
373
374
# File 'lib/filter.rb', line 368

def test_include_block_by_name
  @options[:block_name_include_match] = 'include_block'
  fcb = FCB.new(oname: 'include_block', shell: ShellType::BASH,
                start_line: '')
  Filter.apply_other_filters(@options, @filters, fcb)
  assert_equal true, @filters[:include_name]
end

#test_shell_default_is_bashObject



336
337
338
339
340
341
342
343
# File 'lib/filter.rb', line 336

def test_shell_default_is_bash
  fcb = FCB.new(
    oname: 'test', shell: ShellType::BASH,
    type: BlockType::SHELL, start_line: ''
  )
  Filter.apply_other_filters(@options, @filters, fcb)
  assert_equal true, @filters[:shell_default]
end

#test_shell_default_is_not_bashObject



345
346
347
348
349
# File 'lib/filter.rb', line 345

def test_shell_default_is_not_bash
  fcb = FCB.new(oname: 'test', shell: 'ruby', start_line: '')
  Filter.apply_other_filters(@options, @filters, fcb)
  assert_equal false, @filters[:shell_default]
end

#test_wrap_block_by_nameObject



376
377
378
379
380
381
382
# File 'lib/filter.rb', line 376

def test_wrap_block_by_name
  @options[:block_name_wrapper_match] = 'wrap_block'
  fcb = FCB.new(oname: 'wrap_block', shell: ShellType::BASH,
                start_line: '')
  Filter.apply_other_filters(@options, @filters, fcb)
  assert_equal true, @filters[:wrap_name]
end