mirror of
				https://github.com/red0124/ssp.git
				synced 2025-11-04 14:46:45 +01:00 
			
		
		
		
	WIP, Continue writing additional parser tests
This commit is contained in:
		
							parent
							
								
									37f1fb534f
								
							
						
					
					
						commit
						ba45fe1839
					
				@ -139,12 +139,14 @@ std::vector<std::string> generate_csv_data(const std::vector<field>& data,
 | 
				
			|||||||
#ifdef _WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
    constexpr static auto new_line = "\r\n";
 | 
					    constexpr static auto new_line = "\r\n";
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    constexpr static auto new_line = '\n';
 | 
					    constexpr static auto new_line = "\n";
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    constexpr static auto helper0 = '#';
 | 
					    constexpr static auto helper0 = '#';
 | 
				
			||||||
    constexpr static auto helper1 = '$';
 | 
					    constexpr static auto helper1 = '$';
 | 
				
			||||||
    // constexpr static auto helper3 = '&';
 | 
					    // constexpr static auto helper3 = '&';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    auto escape_s = std::string{escape};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::vector<std::string> output;
 | 
					    std::vector<std::string> output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (setup::escape::enabled && setup::quote::enabled) {
 | 
					    if (setup::escape::enabled && setup::quote::enabled) {
 | 
				
			||||||
@ -162,7 +164,7 @@ std::vector<std::string> generate_csv_data(const std::vector<field>& data,
 | 
				
			|||||||
            rng.rand_insert_n(value, escape, 2);
 | 
					            rng.rand_insert_n(value, escape, 2);
 | 
				
			||||||
            if (!quote_newline) {
 | 
					            if (!quote_newline) {
 | 
				
			||||||
                replace_all2(value, {new_line}, {helper1});
 | 
					                replace_all2(value, {new_line}, {helper1});
 | 
				
			||||||
                replace_all2(value, {helper1}, {escape, new_line});
 | 
					                replace_all2(value, {helper1}, {escape_s + new_line});
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            replace_all2(value, {escape, escape}, {escape});
 | 
					            replace_all2(value, {escape, escape}, {escape});
 | 
				
			||||||
            replace_all2(value, {escape, helper0}, {helper0});
 | 
					            replace_all2(value, {escape, helper0}, {helper0});
 | 
				
			||||||
@ -201,7 +203,7 @@ std::vector<std::string> generate_csv_data(const std::vector<field>& data,
 | 
				
			|||||||
            replace_all2(value, {escape}, {helper0});
 | 
					            replace_all2(value, {escape}, {helper0});
 | 
				
			||||||
            rng.rand_insert_n(value, escape, 3);
 | 
					            rng.rand_insert_n(value, escape, 3);
 | 
				
			||||||
            replace_all2(value, {new_line}, {helper1});
 | 
					            replace_all2(value, {new_line}, {helper1});
 | 
				
			||||||
            replace_all2(value, {helper1}, {escape, new_line});
 | 
					            replace_all2(value, {helper1}, {escape_s + new_line});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            replace_all2(value, {escape, escape}, {escape});
 | 
					            replace_all2(value, {escape, escape}, {escape});
 | 
				
			||||||
            replace_all2(value, {escape, helper0}, {helper0});
 | 
					            replace_all2(value, {escape, helper0}, {helper0});
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user