File tree Expand file tree Collapse file tree 4 files changed +17
-3
lines changed
app/AskMeItems.Model/Parser
test/AskMeItems.Model.Specs/Parsing Expand file tree Collapse file tree 4 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,14 @@ AskMeItems is a little questionnaire presenter and can be used for scientific st
5858 1) :) (will give 1 point)
5959 2) :( (will give 2 points)
6060
61+ ### Using linebreaks
62+
63+ * It is possible to use linebreaks in answer texts
64+
65+ ABC_2: Hello, how are you?
66+ 1) good
67+ 2) bad\nvery bas (will introduce a linebreak)
68+
6169
6270### Running a series of questionnaires
6371
Original file line number Diff line number Diff line change @@ -37,4 +37,5 @@ LIK_3: How do you do?
3737 7)
3838 8)
3939 9)
40- 10) very bad
40+ 10) very bad\nreally bad
41+ 11) worst
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ static Answer BuildAnswer(string line)
2424 var answerParts = line . Split ( ')' ) ;
2525 var code = answerParts [ 0 ] . Trim ( ' ' ) . Trim ( '\t ' ) ;
2626 var textParts = answerParts [ 1 ] . Split ( new [ ] { " - " } , StringSplitOptions . None ) ;
27- var text = textParts [ 0 ] . Trim ( ' ' ) ;
27+ var text = textParts [ 0 ] . Trim ( ' ' ) . Replace ( " \\ n" , " \r \n " ) ;
2828 var points = ParsePoints ( textParts , code ) ;
2929
3030 return new Answer ( code , text , points ) ;
Original file line number Diff line number Diff line change 1+ using System . Linq ;
2+
13using Machine . Specifications ;
24
35namespace AskMeItems . Model . Specs . Parsing
@@ -9,11 +11,14 @@ public class when_parsing_a_likert_questionnaire : when_parsing_from_file
911 It should_use_the_filename_as_questionnaire_code = ( ) => Questionnaire . Code . ShouldEqual ( "Likert" ) ;
1012 It should_be_a_likert_questionnaire = ( ) => Questionnaire . Type . ShouldEqual ( QuestionnaireType . Likert ) ;
1113 It should_contain_two_items = ( ) => Questionnaire . Items . Count . ShouldEqual ( 3 ) ;
12- It should_contain_the__LIK_1_item = ( ) => GetItem ( 0 ) . Code . ShouldEqual ( "LIK_1" ) ;
14+ It should_contain_the_LIK_1_item = ( ) => GetItem ( 0 ) . Code . ShouldEqual ( "LIK_1" ) ;
1315 It should_contain_the_text_for_the_first_answer = ( ) => GetAnswer ( 0 , 0 ) . Text . ShouldEqual ( "sehr" ) ;
1416 It should_contain_no_text_for_the_second_answer = ( ) => GetAnswer ( 0 , 1 ) . Text . ShouldEqual ( "" ) ;
1517 It should_contain_the_points_for_the_second_answer = ( ) => GetAnswer ( 0 , 1 ) . Points . ShouldEqual ( 2 ) ;
1618 It should_contain_the_default_points_if_no_points_are_given = ( ) => GetAnswer ( 0 , 3 ) . Points . ShouldEqual ( 4 ) ;
19+
20+ It should_contain_the_LIK3_item = ( ) => GetItem ( 2 ) . Code . ShouldEqual ( "LIK_3" ) ;
21+ It should_contain_a_linebreak_in_the_LIK3_answer = ( ) => GetItem ( 2 ) . Answers [ "10" ] . Text . ShouldEqual ( "very bad\r \n really bad" ) ;
1722 }
1823
1924 public class when_parsing_a_ADS_questionnaire : when_parsing_from_file
You can’t perform that action at this time.
0 commit comments