diff --git a/vlib/flag/flag.v b/vlib/flag/flag.v index cd9f3e5c61..99ebdd1791 100644 --- a/vlib/flag/flag.v +++ b/vlib/flag/flag.v @@ -23,7 +23,7 @@ module flag // // fp.skip_executable() // -// an_int := fp.int('an_int', 666, 'some int to define 666 is default') +// an_int := fp.int('an_int', 0o666, 'some int to define 0o666 is default') // a_bool := fp.bool('a_bool', false, 'some \'real\' flag') // a_float := fp.float('a_float', 1.0, 'also floats') // a_string := fp.string('a_string', 'no text', 'finally, some text') diff --git a/vlib/flag/flag_test.v b/vlib/flag/flag_test.v index 5851434779..aede4b761d 100644 --- a/vlib/flag/flag_test.v +++ b/vlib/flag/flag_test.v @@ -35,7 +35,7 @@ fn test_flags_could_be_defined_with_eq() { '--a_string=stuff', '--a_bool=true']) - assert 42 == fp.int('an_int', 0, 666, '') + assert 42 == fp.int('an_int', 0, 0o666, '') && true == fp.bool('a_bool', 0, false, '') && true == fp.bool('bool_without', 0, false, '') && 2.0 == fp.float('a_float', 0, 1.0, '') @@ -50,7 +50,7 @@ fn test_values_could_be_defined_without_eq() { '--a_string', 'stuff', '--a_bool', 'true']) - assert 42 == fp.int('an_int', 0, 666, '') + assert 42 == fp.int('an_int', 0, 0o666, '') && true == fp.bool('a_bool', 0, false, '') && true == fp.bool('bool_without', 0, false, '') && 2.0 == fp.float('a_float', 0, 1.0, '') @@ -65,7 +65,7 @@ fn test_values_could_be_defined_mixed() { '--a_string', 'stuff', '--a_bool=true']) - assert 42 == fp.int('an_int', 0, 666, '') + assert 42 == fp.int('an_int', 0, 0o666, '') && true == fp.bool('a_bool', 0, false, '') && true == fp.bool('bool_without', 0, false, '') && 2.0 == fp.float('a_float', 0, 1.0, '') @@ -78,8 +78,8 @@ fn test_beaware_for_argument_names_with_same_prefix() { '--shorter=7' ]) - assert 5 == fp.int('short', 0, 666, '') - && 7 == fp.int('shorter', 0, 666, '') + assert 5 == fp.int('short', 0, 0o666, '') + && 7 == fp.int('shorter', 0, 0o666, '') } fn test_beaware_for_argument_names_with_same_prefix_inverse() { @@ -88,8 +88,8 @@ fn test_beaware_for_argument_names_with_same_prefix_inverse() { '--short', '5', ]) - assert 5 == fp.int('short', 0, 666, '') - && 7 == fp.int('shorter', 0, 666, '') + assert 5 == fp.int('short', 0, 0o666, '') + && 7 == fp.int('shorter', 0, 0o666, '') } fn test_allow_to_skip_executable_path() { @@ -108,7 +108,7 @@ fn test_none_flag_arguments_are_allowed() { mut fp := flag.new_flag_parser([ 'file1', '--an_int=2', 'file2', 'file3', '--bool_without', 'file4', '--outfile', 'outfile']) - assert 2 == fp.int('an_int', 0, 666, '') + assert 2 == fp.int('an_int', 0, 0o666, '') && 'outfile' == fp.string('outfile', 0, 'bad', '') && true == fp.bool('bool_without', 0, false, '') } @@ -149,7 +149,7 @@ fn test_allow_to_build_usage_message() { fp.version('v0.0.0') fp.description('some short information about this tool') - fp.int('an_int', 0, 666, 'some int to define') + fp.int('an_int', 0, 0o666, 'some int to define') fp.bool('a_bool', 0, false, 'some bool to define') fp.bool('bool_without_but_really_big', 0, false, 'this should appear on the next line') fp.float('a_float', 0, 1.0, 'some float as well')