Sha256: 343d3df8cd4d642d3e070f4b7985e1eafd4927129ca4b4895a470fb80c6ed5c3
Contents?: true
Size: 1.7 KB
Versions: 6
Compression:
Stored size: 1.7 KB
Contents
require 'asciidoctor' require 'asciidoctor/latex' require 'asciidoctor/latex/core_ext/colored_string' require_relative 'transform' include Transform VERBOSE = true def compare_transform input, expected_output, transfomer warn ' ' if VERBOSE warn input.blue if VERBOSE warn expected_output.cyan if VERBOSE output = Transform.map_string input, transfomer warn output.blue if VERBOSE warn ' ' if VERBOSE expect(output).to eq expected_output end describe Transform do before :each do end it 'reads the contents of a file into a string (A1)' do contents = Transform.read_string 'data/foo' expect(contents.chomp).to eq 'foo.bar' end it 'implements the identity transform on strings (A2)' do input = 'foo' output = Transform.map_string input, $identity expect(input).to eq output end it 'maps dollar-delimted strings to escapa-paren delimited strings (A3)' do input = 'ha ha ha $a^2 = 1$ ho ho ho' expected_output = 'ha ha ha \\(a^2 = 1\\) ho ho ho' compare_transform input, expected_output, $fixmath end it 'maps dollar-delimted strings to latexmath-delimited strings' do input = 'ha ha ha $a^2 = 1$ ho ho ho' expected_output = 'ha ha ha latexmath:[a^2 = 1] ho ho ho' compare_transform input, expected_output, $fixmath2 end it 'reads strings from files' do input = Transform.read_string 'data/lorem' expect(input.length).to be > 0 end it 'implements the identity transform on files' do Transform.map_file 'data/lorem', 'data/tmp', $identity original_content = Transform.read_string 'data/lorem' transformed_content = Transform.read_string 'data/tmp' expect(transformed_content).to eq original_content end end
Version data entries
6 entries across 3 versions & 1 rubygems