Skip to content

Instantly share code, notes, and snippets.

@kungfoo
Created June 29, 2010 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kungfoo/457163 to your computer and use it in GitHub Desktop.
Save kungfoo/457163 to your computer and use it in GitHub Desktop.
require File.join(File.dirname(__FILE__), "..", "spec_helper")
require File.join(File.dirname(__FILE__), "fake_document")
include Redcar
describe AutoIndenter::Analyzer do
scala = <<-SCALA
package ch.mollusca.stomp.frame
import org.scalatest.Spec
class FrameProcessorSpec extends Spec {
val frameProcessor = new FrameProcessor
describe("The frame processor") {
it("should handle a complete CONNECT frame") {
assert(frame.content === "message body.")
}
}
}
SCALA
def should_indent(src, options)
simple_rules = AutoIndenter::Rules.new(
/\{/,
/\}/,
/^(?!.*;\s*\/\/).*[^\s;{}]\s*$/,
/^\s*(\/\/|#).*$/
)
analyzer = AutoIndenter::Analyzer.new(simple_rules, FakeDocument.new(source, 2, false), 2, false)
analyzer.calculate_for_line(options[:line]).should == options[:indent]
end
describe "with Scala's real indentation rules loaded" do
it "should indent correctly after curly braces" do
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment