SQLFormatter.Assertions (sql_formatter v1.0.0)
View SourceHelper functions for SQL formatting tests.
This module provides utilities for testing SQL formatting, particularly useful for libraries that extend or customize SQLFormatter.
Example
defmodule MyFormatterTest do
use ExUnit.Case
import SQLFormatter.Assertions, only: [assert_sql_equal: 2]
test "formats my custom SQL" do
assert_sql_equal(
MyFormatter.format("SELECT * FROM table"),
"""
SELECT
*
FROM
table
"""
)
end
end
Summary
Functions
Asserts that two SQL strings are equal, ignoring insignificant whitespace differences.
Asserts that two SQL strings are not equal, ignoring insignificant whitespace differences.
Functions
Asserts that two SQL strings are equal, ignoring insignificant whitespace differences.
Provides a detailed diff output when the assertion fails, making it easier to spot formatting differences between the expected and actual SQL.
Examples
assert_sql_equal(
"SELECT * FROM users",
"""
SELECT
*
FROM
users
"""
)
Asserts that two SQL strings are not equal, ignoring insignificant whitespace differences.
Provides a detailed diff output when the assertion fails, making it easier to spot formatting differences between the expected and actual SQL.
Examples
refute_sql_equal(
"SELECT * FROM users",
"SELECT * FROM user"
)