Class: MarkdownExec::TestApplyOtherFilters

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

Instance Method Summary collapse

Instance Method Details

#setupObject



303
304
305
306
# File 'lib/filter.rb', line 303

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

#test_disable_block_when_match_foundObject



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

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



308
309
310
311
312
313
# File 'lib/filter.rb', line 308

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



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

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



347
348
349
350
351
352
353
# File 'lib/filter.rb', line 347

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



315
316
317
318
319
320
321
322
# File 'lib/filter.rb', line 315

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



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

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



355
356
357
358
359
360
361
# File 'lib/filter.rb', line 355

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