@@ -7,7 +7,10 @@ describe('crystal runner', function() {
77 runner . assertCodeExamples ( 'crystal' ) ;
88
99 it ( 'should handle basic code evaluation' , function ( done ) {
10- runner . run ( { language : 'crystal' , code : 'puts 42' } , function ( buffer ) {
10+ runner . run ( {
11+ language : 'crystal' ,
12+ code : 'puts 42'
13+ } , function ( buffer ) {
1114 expect ( buffer . stdout ) . to . equal ( '42\n' ) ;
1215 done ( ) ;
1316 } ) ;
@@ -18,12 +21,14 @@ describe('crystal runner', function() {
1821 runner . run ( {
1922 language : 'crystal' ,
2023 code : 'a = 1' ,
21- fixture : 'describe "test" do\n' +
22- 'it("test2") { 1.should eq(1)}\n' +
23- 'end' ,
24+ fixture : [
25+ 'describe "test" do' ,
26+ ' it("test2") { 1.should eq(1) }' ,
27+ 'end' ,
28+ ] . join ( '\n' ) ,
2429 testFramework : 'spec'
2530 } , function ( buffer ) {
26- expect ( buffer . stdout ) . to . include ( '<DESCRIBE::>test\n<IT::>test2\n<PASSED::>' ) ;
31+ expect ( buffer . stdout ) . to . include ( '<DESCRIBE::>test\n\n <IT::>test2\n \n<PASSED::>' ) ;
2732 done ( ) ;
2833 } ) ;
2934 } ) ;
@@ -32,32 +37,56 @@ describe('crystal runner', function() {
3237 runner . run ( {
3338 language : 'crystal' ,
3439 code : 'a = 1' ,
35- fixture : 'describe "test" do\n' +
36- 'it("test2") { 1.should eq(2)}\n' +
37- 'end' ,
40+ fixture : [
41+ 'describe "test" do' ,
42+ ' it("test2") { 1.should eq(2) }' ,
43+ 'end' ,
44+ ] . join ( '\n' ) ,
3845 testFramework : 'spec'
3946 } , function ( buffer ) {
40- expect ( buffer . stdout ) . to . contain ( '<DESCRIBE::>test\n<IT::>test2' ) ;
47+ expect ( buffer . stdout ) . to . contain ( '<DESCRIBE::>test\n\n <IT::>test2' ) ;
4148 expect ( buffer . stdout ) . to . contain ( '<FAILED::>' ) ;
4249 expect ( buffer . stdout ) . to . not . contain ( '<PASSED::>' ) ;
4350 done ( ) ;
4451 } ) ;
4552 } ) ;
53+
4654 it ( 'should handle errored code' , function ( done ) {
4755 runner . run ( {
4856 language : 'crystal' ,
4957 code : 'A = 1' ,
50- fixture : 'describe "test" do\n' +
51- 'it("test2") { A.should eq 1 }\n' +
52- 'it("test2") { A.idontexist()}\n' +
53- 'end' ,
58+ fixture : [
59+ 'describe "test" do' ,
60+ ' it("test2") { A.should eq 1 }' ,
61+ ' it("test2") { A.idontexist() }' ,
62+ 'end' ,
63+ ] . join ( '\n' ) ,
5464 testFramework : 'spec'
5565 } , function ( buffer ) {
5666 expect ( buffer . stdout ) . to . eq ( '' ) ;
5767 expect ( buffer . stderr ) . to . contain ( 'undefined method' ) ;
5868 done ( ) ;
5969 } ) ;
6070 } ) ;
71+
72+ it ( 'should have output format command on independent line' , function ( done ) {
73+ runner . run ( {
74+ language : 'crystal' ,
75+ testFramework : 'spec' ,
76+ code : '#' ,
77+ fixture : [
78+ 'describe "tests" do' ,
79+ ' it "test case" do' ,
80+ ' print "foo"' ,
81+ ' 1.should eq 2' ,
82+ ' end' ,
83+ 'end' ,
84+ ] . join ( '\n' ) ,
85+ } , function ( buffer ) {
86+ expect ( buffer . stdout ) . to . contain ( '\n<FAILED::>' ) ;
87+ done ( ) ;
88+ } ) ;
89+ } ) ;
6190 } ) ;
6291 } ) ;
6392} ) ;
0 commit comments