real_data_tests 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/real_data_tests/rspec_helper.rb +26 -16
- data/lib/real_data_tests/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1ff52aca9c674699aa8e7d5cbe17de0db5860b69f0161b2408a1cd239abeadd
|
4
|
+
data.tar.gz: f8bdffcbd90e239bbf92cfc4fea32a0025a31d5a80b53e4c92c9db08c3babfa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbfb177889ae4ff86637eaa345c89a64faa9357cab0d0ec87a444b29d092fa1fc4750316d818c8afb5d679204a808abcfb6c71fdb47da53f0fdce43d2ebb156
|
7
|
+
data.tar.gz: 65c58cc33ef5c68579dd04196a6104d62cd97f3f5d764340bdcbeccbaf69c8181c9dfd6e08812e353ecbf0913467b965b86c3718d928d3abfb80a0be766a8b4a
|
@@ -78,27 +78,37 @@ module RealDataTests
|
|
78
78
|
escaped = false
|
79
79
|
|
80
80
|
sql.each_char do |char|
|
81
|
-
|
82
|
-
when '\\'
|
81
|
+
if char == '\\'
|
83
82
|
escaped = !escaped
|
84
|
-
|
85
|
-
in_string = !in_string
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
83
|
+
elsif char == "'" && !escaped
|
84
|
+
in_string = !in_string
|
85
|
+
elsif char == ';' && !in_string
|
86
|
+
# Add the completed statement
|
87
|
+
statements << current_statement.strip unless current_statement.strip.empty?
|
88
|
+
current_statement = ''
|
89
|
+
next
|
90
|
+
end
|
91
|
+
escaped = false
|
92
|
+
current_statement << char
|
93
|
+
end
|
94
|
+
|
95
|
+
# Add the last statement if it exists
|
96
|
+
statements << current_statement.strip unless current_statement.strip.empty?
|
97
|
+
|
98
|
+
# Ensure `ON CONFLICT` stays with the previous statement
|
99
|
+
statements = statements.each_with_object([]) do |stmt, result|
|
100
|
+
if stmt.strip.upcase.start_with?('ON CONFLICT')
|
101
|
+
result[-1] = "#{result.last.strip} #{stmt.strip}"
|
94
102
|
else
|
95
|
-
|
96
|
-
current_statement << char
|
103
|
+
result << stmt.strip
|
97
104
|
end
|
98
105
|
end
|
99
106
|
|
100
|
-
#
|
101
|
-
statements
|
107
|
+
# Normalize spacing around `ON CONFLICT` and ensure semicolons
|
108
|
+
statements.map! do |stmt|
|
109
|
+
stmt = stmt.gsub(/\)\s*ON CONFLICT/, ') ON CONFLICT') # Normalize spacing
|
110
|
+
stmt.strip.end_with?(';') ? stmt.strip : "#{stmt.strip};" # Ensure semicolon
|
111
|
+
end
|
102
112
|
|
103
113
|
statements
|
104
114
|
end
|