tests/PPTokenTest.st
changeset 405 0470a5e6e712
parent 380 8fe3cb4e607f
child 427 a7f5e6de19d2
equal deleted inserted replaced
404:8da796db7f95 405:0470a5e6e712
    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 codePoint: 13)) , '12' , (String with: (Character codePoint: 13) with: (Character codePoint: 10)) , '123'
    93 	input := '1' , (String with: (Character codePoint: 13)) , '12' , (String with: (Character codePoint: 13) with: (Character codePoint: 10)) , '123'
    94                 , (String with: (Character codePoint: 10)) , '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>"
       
   100 !
    98 !
   101 
    99 
   102 testLine
   100 testLine
   103         | input parser result |
   101 	| input parser result |
   104         input := '1' , (String with: (Character codePoint: 13)) , '12' , (String with:(Character codePoint: 13) with: (Character codePoint: 10)) , '123'
   102 	input := '1' , (String with: (Character codePoint: 13)) , '12' , (String with: (Character codePoint: 13) with: (Character codePoint: 10)) , '123'
   105                 , (String with: (Character codePoint: 10)) , '1234'.
   103 		, (String with: (Character codePoint: 10)) , '1234'.
   106         parser := #any asParser token star.
   104 	parser := #any asParser token star.
   107         result := parser parse: input.
   105 	result := parser parse: input.
   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 ]
   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 ]
   109 
       
   110     "Modified: / 03-10-2014 / 23:54:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   111 ! !
   107 ! !
   112 
   108 
   113 !PPTokenTest methodsFor:'testing-values'!
   109 !PPTokenTest methodsFor:'testing-values'!
   114 
   110 
   115 testInputValue
   111 testInputValue