@@ -436,7 +436,7 @@ class Shell_cmdline_options : public ::testing::Test {
436
436
437
437
TEST_F (Shell_cmdline_options, default_values) {
438
438
int argc = 0 ;
439
- char **argv = NULL ;
439
+ char **argv = nullptr ;
440
440
441
441
Shell_command_line_options cmd_options (argc, argv);
442
442
mysqlsh::Shell_options options = cmd_options.get_options ();
@@ -719,9 +719,9 @@ TEST_F(Shell_cmdline_options, conflicts_session_type) {
719
719
" Classic session configured with --classic.\n " ;
720
720
721
721
char *argv0[] = {
722
- " ut" ,
723
- " --classic" ,
724
- " --uri=mysqlx://root@localhost" ,
722
+ const_cast < char *>( " ut" ) ,
723
+ const_cast < char *>( " --classic" ) ,
724
+ const_cast < char *>( " --uri=mysqlx://root@localhost" ) ,
725
725
NULL
726
726
};
727
727
@@ -733,9 +733,9 @@ TEST_F(Shell_cmdline_options, conflicts_session_type) {
733
733
" Classic session configured with --sqlc.\n " ;
734
734
735
735
char *argv0[] = {
736
- " ut" ,
737
- " --sqlc" ,
738
- " --uri=mysqlx://root@localhost" ,
736
+ const_cast < char *>( " ut" ) ,
737
+ const_cast < char *>( " --sqlc" ) ,
738
+ const_cast < char *>( " --uri=mysqlx://root@localhost" ) ,
739
739
NULL
740
740
};
741
741
@@ -747,9 +747,9 @@ TEST_F(Shell_cmdline_options, conflicts_session_type) {
747
747
" Node session configured with --node.\n " ;
748
748
749
749
char *argv1[] = {
750
- " ut" ,
751
- " --node" ,
752
- " --uri=mysql://root@localhost" ,
750
+ const_cast < char *>( " ut" ) ,
751
+ const_cast < char *>( " --node" ) ,
752
+ const_cast < char *>( " --uri=mysql://root@localhost" ) ,
753
753
NULL
754
754
};
755
755
@@ -761,9 +761,9 @@ TEST_F(Shell_cmdline_options, conflicts_session_type) {
761
761
" Node session configured with --sqln.\n " ;
762
762
763
763
char *argv1[] = {
764
- " ut" ,
765
- " --sqln" ,
766
- " --uri=mysql://root@localhost" ,
764
+ const_cast < char *>( " ut" ) ,
765
+ const_cast < char *>( " --sqln" ) ,
766
+ const_cast < char *>( " --uri=mysql://root@localhost" ) ,
767
767
NULL
768
768
};
769
769
@@ -777,9 +777,9 @@ TEST_F(Shell_cmdline_options, conflicts_user) {
777
777
" user in the URI.\n " ;
778
778
779
779
char *argv0[] = {
780
- " ut" ,
781
- " --user=guest" ,
782
- " --uri=mysqlx://root@localhost" ,
780
+ const_cast < char *>( " ut" ) ,
781
+ const_cast < char *>( " --user=guest" ) ,
782
+ const_cast < char *>( " --uri=mysqlx://root@localhost" ) ,
783
783
NULL
784
784
};
785
785
@@ -793,7 +793,7 @@ TEST_F(Shell_cmdline_options, conflicts_password) {
793
793
char pwd[] = {" --password=example" };
794
794
char uri[] = {" --uri=mysqlx://root:password@localhost" };
795
795
char *argv0[] = {
796
- " ut" ,
796
+ const_cast < char *>( " ut" ) ,
797
797
pwd,
798
798
uri,
799
799
NULL
@@ -808,8 +808,8 @@ TEST_F(Shell_cmdline_options, conflicts_host) {
808
808
809
809
char uri[] = " --uri=mysqlx://root:password@localhost" ;
810
810
char *argv0[] = {
811
- " ut" ,
812
- " --host=127.0.0.1" ,
811
+ const_cast < char *>( " ut" ) ,
812
+ const_cast < char *>( " --host=127.0.0.1" ) ,
813
813
uri,
814
814
NULL
815
815
};
@@ -822,20 +822,20 @@ TEST_F(Shell_cmdline_options, conflicts_host_socket) {
822
822
" not 'localhost'.\n " ;
823
823
824
824
char *argv0[] = {
825
- " ut" ,
826
-
827
- " --socket=/some/socket/path" ,
825
+ const_cast < char *>( " ut" ) ,
826
+ const_cast < char *>( " [email protected] " ) ,
827
+ const_cast < char *>( " --socket=/some/socket/path" ) ,
828
828
NULL
829
829
};
830
830
test_conflicting_options (" --uri --socket" , 3 , argv0, error);
831
831
832
832
char *argv1[] = {
833
- " ut" ,
834
- " --host=127.0.0.1" ,
835
- " --socket=/some/socket/path" ,
833
+ const_cast < char *>( " ut" ) ,
834
+ const_cast < char *>( " --host=127.0.0.1" ) ,
835
+ const_cast < char *>( " --socket=/some/socket/path" ) ,
836
836
NULL
837
837
};
838
- test_conflicting_options (" --host --socket" , 3 , argv0 , error);
838
+ test_conflicting_options (" --host --socket" , 3 , argv1 , error);
839
839
840
840
}
841
841
@@ -845,8 +845,8 @@ TEST_F(Shell_cmdline_options, conflicts_port) {
845
845
846
846
char uri[] = {" --uri=mysqlx://root:password@localhost:3307" };
847
847
char *argv0[] = {
848
- " ut" ,
849
- " --port=3306" ,
848
+ const_cast < char *>( " ut" ) ,
849
+ const_cast < char *>( " --port=3306" ) ,
850
850
uri,
851
851
NULL
852
852
};
@@ -859,9 +859,9 @@ TEST_F(Shell_cmdline_options, conflicts_socket) {
859
859
" socket in the URI.\n " ;
860
860
861
861
char *argv0[] = {
862
- " ut" ,
863
- " --socket=/path/to/socket" ,
864
- " --uri=mysqlx://root@/socket" ,
862
+ const_cast < char *>( " ut" ) ,
863
+ const_cast < char *>( " --socket=/path/to/socket" ) ,
864
+ const_cast < char *>( " --uri=mysqlx://root@/socket" ) ,
865
865
NULL
866
866
};
867
867
@@ -874,9 +874,9 @@ TEST_F(Shell_cmdline_options, conflicting_port_and_socket) {
874
874
" together.\n " ;
875
875
876
876
char *argv0[] = {
877
- " ut" ,
878
- " --port=3307" ,
879
- " --socket=/some/weird/path" ,
877
+ const_cast < char *>( " ut" ) ,
878
+ const_cast < char *>( " --port=3307" ) ,
879
+ const_cast < char *>( " --socket=/some/weird/path" ) ,
880
880
NULL
881
881
};
882
882
@@ -886,9 +886,9 @@ TEST_F(Shell_cmdline_options, conflicting_port_and_socket) {
886
886
" contains a socket.\n " ;
887
887
888
888
char *argv1[] = {
889
- " ut" ,
890
- " --uri=root@/socket" ,
891
- " --port=3306" ,
889
+ const_cast < char *>( " ut" ) ,
890
+ const_cast < char *>( " --uri=root@/socket" ) ,
891
+ const_cast < char *>( " --port=3306" ) ,
892
892
NULL
893
893
};
894
894
@@ -898,9 +898,9 @@ TEST_F(Shell_cmdline_options, conflicting_port_and_socket) {
898
898
" contains a port.\n " ;
899
899
900
900
char *argv2[] = {
901
- " ut" ,
902
- " --uri=root@localhost:3306" ,
903
- " --socket=/some/socket/path" ,
901
+ const_cast < char *>( " ut" ) ,
902
+ const_cast < char *>( " --uri=root@localhost:3306" ) ,
903
+ const_cast < char *>( " --socket=/some/socket/path" ) ,
904
904
NULL
905
905
};
906
906
@@ -969,7 +969,11 @@ TEST_F(Shell_cmdline_options, test_uri_with_password) {
969
969
TEST_F (Shell_cmdline_options, test_deprecated_ssl) {
970
970
{
971
971
std::string error = " The --ssl option is deprecated, use --ssl-mode instead" ;
972
- std::vector<char *> options = {" ut" , " --ssl" , " something" , NULL };
972
+ std::vector<char *> options = {
973
+ const_cast <char *>(" ut" ),
974
+ const_cast <char *>(" --ssl" ),
975
+ const_cast <char *>(" something" ),
976
+ NULL };
973
977
test_deprecated_ssl (" --ssl=something" , options, error, 1 ,
974
978
shcore::SslMode::Preferred); // This last param is
975
979
// ignored on this case
@@ -978,36 +982,47 @@ TEST_F(Shell_cmdline_options, test_deprecated_ssl) {
978
982
std::string wrequired = " WARNING: the --ssl option is deprecated, "
979
983
" using --ssl-mode=REQUIRED" ;
980
984
{
981
- std::vector<char *> options = {" ut" , " --ssl" , NULL };
985
+ std::vector<char *> options = {
986
+ const_cast <char *>(" ut" ),
987
+ const_cast <char *>(" --ssl" ),
988
+ NULL };
982
989
test_deprecated_ssl (" --ssl" , options, wrequired, 0 ,
983
990
shcore::SslMode::Required);
984
991
}
985
992
{
986
- std::vector<char *> options = {" ut" , " --ssl=1" , NULL };
993
+ std::vector<char *> options = {
994
+ const_cast <char *>(" ut" ),
995
+ const_cast <char *>(" --ssl=1" ),
996
+ NULL };
987
997
test_deprecated_ssl (" --ssl=1" , options, wrequired, 0 ,
988
998
shcore::SslMode::Required);
989
999
}
990
1000
{
991
- std::vector<char *> options = {" ut" , " --ssl=yes" , NULL };
1001
+ std::vector<char *> options = {
1002
+ const_cast <char *>(" ut" ),
1003
+ const_cast <char *>(" --ssl=yes" ),
1004
+ NULL };
992
1005
test_deprecated_ssl (" --ssl=yes" , options, wrequired, 0 ,
993
1006
shcore::SslMode::Required);
994
1007
}
995
1008
996
1009
std::string wdisabled = " WARNING: the --ssl option is deprecated, "
997
1010
" using --ssl-mode=DISABLED" ;
998
1011
{
999
- std::vector<char *> options = {" ut" , " --ssl=0" , NULL };
1012
+ std::vector<char *> options = {
1013
+ const_cast <char *>(" ut" ),
1014
+ const_cast <char *>(" --ssl=0" ),
1015
+ NULL };
1000
1016
test_deprecated_ssl (" --ssl=0" , options, wdisabled, 0 ,
1001
1017
shcore::SslMode::Disabled);
1002
1018
}
1003
1019
{
1004
- std::vector<char *> options = {" ut" , " --ssl=no" , NULL };
1020
+ std::vector<char *> options = {
1021
+ const_cast <char *>(" ut" ),
1022
+ const_cast <char *>(" --ssl=no" ),
1023
+ NULL };
1005
1024
test_deprecated_ssl (" --ssl=no" , options, wdisabled, 0 ,
1006
1025
shcore::SslMode::Disabled);
1007
1026
}
1008
1027
}
1009
-
1010
1028
}
1011
-
1012
-
1013
-
0 commit comments