tests/PPTokenTest.st
changeset 380 8fe3cb4e607f
parent 377 6112a403a52d
child 405 0470a5e6e712
equal deleted inserted replaced
379:451b5ae38b72 380:8fe3cb4e607f
    87 ! !
    87 ! !
    88 
    88 
    89 !PPTokenTest methodsFor:'testing-querying'!
    89 !PPTokenTest methodsFor:'testing-querying'!
    90 
    90 
    91 testColumn
    91 testColumn
    92 	| input parser result |
    92         | input parser result |
    93 	input := '1' , (String with: Character cr) , '12' , (String with: Character cr with: Character lf) , '123'
    93         input := '1' , (String with: (Character codePoint: 13)) , '12' , (String with: (Character codePoint: 13) with: (Character codePoint: 10)) , '123'
    94 		, (String with: Character lf) , '1234'.
    94                 , (String with: (Character codePoint: 10)) , '1234'.
    95 	parser := #any asParser token star.
    95         parser := #any asParser token star.
    96 	result := parser parse: input.
    96         result := parser parse: input.
    97 	result with: #(1 2 1 2 3 4 1 2 3 4 1 2 3 4) do: [ :token :line | self assert: token column equals: line ]
    97         result with: #(1 2 1 2 3 4 1 2 3 4 1 2 3 4) do: [ :token :line | self assert: token column equals: line ]
       
    98 
       
    99     "Modified: / 03-10-2014 / 23:53:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    98 !
   100 !
    99 
   101 
   100 testLine
   102 testLine
   101 	| input parser result |
   103         | input parser result |
   102 	input := '1' , (String with: Character cr) , '12' , (String with: Character cr with: Character lf) , '123'
   104         input := '1' , (String with: (Character codePoint: 13)) , '12' , (String with:(Character codePoint: 13) with: (Character codePoint: 10)) , '123'
   103 		, (String with: Character lf) , '1234'.
   105                 , (String with: (Character codePoint: 10)) , '1234'.
   104 	parser := #any asParser token star.
   106         parser := #any asParser token star.
   105 	result := parser parse: input.
   107         result := parser parse: input.
   106 	result with: #(1 1 2 2 2 2 3 3 3 3 4 4 4 4) do: [ :token :line | self assert: token line equals: line ]
   108         result with: #(1 1 2 2 2 2 3 3 3 3 4 4 4 4) do: [ :token :line | self assert: token line equals: line ]
       
   109 
       
   110     "Modified: / 03-10-2014 / 23:54:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   107 ! !
   111 ! !
   108 
   112 
   109 !PPTokenTest methodsFor:'testing-values'!
   113 !PPTokenTest methodsFor:'testing-values'!
   110 
   114 
   111 testInputValue
   115 testInputValue