Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/spec/lib/msf/ui/console/command_dispatcher_spec.rb
Views: 11766
require 'rspec'12RSpec.describe Msf::Ui::Console::CommandDispatcher do3include_context 'Msf::DBManager'4include_context 'Msf::UIDriver'56let(:subject) do7dummy_class = Class.new8dummy_class.include described_class9dummy_class.new(driver)10end1112describe '#build_range_array' do13[14{ input: '1', expected: [1] },15{ input: '123', expected: [123] },16{ input: '-1', expected: [-1] },17{ input: '-123', expected: [-123] },18{ input: '1,2', expected: [1, 2] },19{ input: '-1,2', expected: [-1, 2] },20{ input: '2,-1', expected: [-1, 2] },21{ input: '-1,-2', expected: [-2, -1] },22{ input: '-1-', expected: nil },23{ input: '-1-,2', expected: nil },24{ input: '-1--,2', expected: nil },25{ input: '---1', expected: nil },26{ input: '1--', expected: nil },27{ input: '1-3', expected: [1, 2, 3] },28{ input: '-1-3', expected: nil },29{ input: '-1--4', expected: nil },30{ input: '1..4', expected: [1, 2, 3, 4] },31{ input: '1..-4', expected: nil },32{ input: '-1..4', expected: nil },33{ input: '-1..-4', expected: nil },34{ input: '-1,0-3', expected: [-1, 0, 1, 2, 3] },35{ input: '-1,0,1,2', expected: [-1, 0, 1, 2] },36{ input: '-1,-1', expected: [-1] },37{ input: '-1,1..2', expected: [-1, 1, 2] }38].each do |test|39it "returns #{test[:expected].inspect} for the input #{test[:input]}" do40expect(subject.build_range_array(test[:input])).to eq(test[:expected])41end42end43end44end454647