MCPcopy
hub / github.com/sqldef/sqldef / TestSQLiteTableOptions

Function TestSQLiteTableOptions

parser/parser_test.go:777–817  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

775}
776
777func TestSQLiteTableOptions(t *testing.T) {
778 testCases := []struct {
779 name string
780 sql string
781 want string
782 }{
783 {
784 "strict",
785 "CREATE TABLE t (id integer PRIMARY KEY) STRICT",
786 "create table t (\n\tid integer primary key\n) STRICT",
787 },
788 {
789 "without rowid",
790 "CREATE TABLE t (id integer PRIMARY KEY) WITHOUT ROWID",
791 "create table t (\n\tid integer primary key\n) WITHOUT ROWID",
792 },
793 {
794 "strict and without rowid",
795 "CREATE TABLE t (id integer PRIMARY KEY, data text) STRICT, WITHOUT ROWID",
796 "create table t (\n\tid integer primary key,\n\tdata text\n) STRICT, WITHOUT ROWID",
797 },
798 {
799 "any type in strict table",
800 "CREATE TABLE t (id integer PRIMARY KEY, data ANY) STRICT",
801 "create table t (\n\tid integer primary key,\n\tdata ANY\n) STRICT",
802 },
803 }
804
805 for _, tc := range testCases {
806 t.Run(tc.name, func(t *testing.T) {
807 tree, err := ParseDDL(tc.sql, ParserModeSQLite3)
808 if err != nil {
809 t.Fatalf("parse error: %v", err)
810 }
811 got := String(tree)
812 if got != tc.want {
813 t.Errorf("got:\n%s\nwant:\n%s", got, tc.want)
814 }
815 })
816 }
817}
818
819func TestCreatePolicyPredicates(t *testing.T) {
820 testCases := []string{

Callers

nothing calls this directly

Calls 4

ParseDDLFunction · 0.85
StringFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected